mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 12:28:15 +08:00
CodeFirst sqlserver支持跨库/跨schema改表名,mysql支持跨库改表名,postgresql支持跨schema改表名
This commit is contained in:
@ -189,29 +189,12 @@ namespace FreeSql {
|
||||
/// <returns></returns>
|
||||
ISelect<T1> Where<T2, T3, T4, T5>(Expression<Func<T1, T2, T3, T4, T5, bool>> exp) where T2 : class where T3 : class where T4 : class where T5 : class;
|
||||
|
||||
/// <summary>
|
||||
/// 模糊查询,选择多个列 OR,WhereLike(a => new[] { a.Title, a.Content }, "%sql%")
|
||||
/// </summary>
|
||||
/// <param name="columns">lambda选择列</param>
|
||||
/// <param name="pattern">查询内容</param>
|
||||
/// <param name="notLike">not like</param>
|
||||
/// <returns></returns>
|
||||
ISelect<T1> WhereLike(Expression<Func<T1, string[]>> columns, string pattern, bool notLike = false);
|
||||
/// <summary>
|
||||
/// 模糊查询,WhereLike(a => a.Title, "%sql")
|
||||
/// </summary>
|
||||
/// <param name="column">lambda选择列</param>
|
||||
/// <param name="pattern">查询内容</param>
|
||||
/// <param name="notLike">not like</param>
|
||||
/// <returns></returns>
|
||||
ISelect<T1> WhereLike(Expression<Func<T1, string>> column, string pattern, bool notLike = false);
|
||||
|
||||
/// <summary>
|
||||
/// 按选择的列分组,GroupBy(a => a.Name) | GroupBy(a => new{a.Name,a.Time}) | GroupBy(a => new[]{"name","time"})
|
||||
/// </summary>
|
||||
/// <param name="columns"></param>
|
||||
/// <returns></returns>
|
||||
ISelect<T1> GroupBy(Expression<Func<T1, object>> columns);
|
||||
ISelect<T1> GroupBy<TKey>(Expression<Func<T1, TKey>> columns);
|
||||
|
||||
/// <summary>
|
||||
/// 按列排序,OrderBy(a => a.Time)
|
||||
|
@ -15,9 +15,6 @@ namespace FreeSql {
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Where(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool>> exp);
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool>> exp);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> WhereLike(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, string[]>> columns, string pattern, bool notLike = false);
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> WhereLike(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, string>> column, string pattern, bool notLike = false);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> GroupBy(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, object>> columns);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> OrderBy<TMember>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TMember>> column);
|
||||
|
@ -15,9 +15,6 @@ namespace FreeSql {
|
||||
ISelect<T1, T2> Where(Expression<Func<T1, T2, bool>> exp);
|
||||
ISelect<T1, T2> WhereIf(bool condition, Expression<Func<T1, T2, bool>> exp);
|
||||
|
||||
ISelect<T1, T2> WhereLike(Expression<Func<T1, T2, string[]>> columns, string pattern, bool notLike = false);
|
||||
ISelect<T1, T2> WhereLike(Expression<Func<T1, T2, string>> column, string pattern, bool notLike = false);
|
||||
|
||||
ISelect<T1, T2> GroupBy(Expression<Func<T1, T2, object>> columns);
|
||||
|
||||
ISelect<T1, T2> OrderBy<TMember>(Expression<Func<T1, T2, TMember>> column);
|
||||
|
@ -15,9 +15,6 @@ namespace FreeSql {
|
||||
ISelect<T1, T2, T3> Where(Expression<Func<T1, T2, T3, bool>> exp);
|
||||
ISelect<T1, T2, T3> WhereIf(bool condition, Expression<Func<T1, T2, T3, bool>> exp);
|
||||
|
||||
ISelect<T1, T2, T3> WhereLike(Expression<Func<T1, T2, T3, string[]>> columns, string pattern, bool notLike = false);
|
||||
ISelect<T1, T2, T3> WhereLike(Expression<Func<T1, T2, T3, string>> column, string pattern, bool notLike = false);
|
||||
|
||||
ISelect<T1, T2, T3> GroupBy(Expression<Func<T1, T2, T3, object>> columns);
|
||||
|
||||
ISelect<T1, T2, T3> OrderBy<TMember>(Expression<Func<T1, T2, T3, TMember>> column);
|
||||
|
@ -15,9 +15,6 @@ namespace FreeSql {
|
||||
ISelect<T1, T2, T3, T4> Where(Expression<Func<T1, T2, T3, T4, bool>> exp);
|
||||
ISelect<T1, T2, T3, T4> WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, bool>> exp);
|
||||
|
||||
ISelect<T1, T2, T3, T4> WhereLike(Expression<Func<T1, T2, T3, T4, string[]>> columns, string pattern, bool notLike = false);
|
||||
ISelect<T1, T2, T3, T4> WhereLike(Expression<Func<T1, T2, T3, T4, string>> column, string pattern, bool notLike = false);
|
||||
|
||||
ISelect<T1, T2, T3, T4> GroupBy(Expression<Func<T1, T2, T3, T4, object>> columns);
|
||||
|
||||
ISelect<T1, T2, T3, T4> OrderBy<TMember>(Expression<Func<T1, T2, T3, T4, TMember>> column);
|
||||
|
@ -15,9 +15,6 @@ namespace FreeSql {
|
||||
ISelect<T1, T2, T3, T4, T5> Where(Expression<Func<T1, T2, T3, T4, T5, bool>> exp);
|
||||
ISelect<T1, T2, T3, T4, T5> WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, T5, bool>> exp);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5> WhereLike(Expression<Func<T1, T2, T3, T4, T5, string[]>> columns, string pattern, bool notLike = false);
|
||||
ISelect<T1, T2, T3, T4, T5> WhereLike(Expression<Func<T1, T2, T3, T4, T5, string>> column, string pattern, bool notLike = false);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5> GroupBy(Expression<Func<T1, T2, T3, T4, T5, object>> columns);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5> OrderBy<TMember>(Expression<Func<T1, T2, T3, T4, T5, TMember>> column);
|
||||
|
@ -15,9 +15,6 @@ namespace FreeSql {
|
||||
ISelect<T1, T2, T3, T4, T5, T6> Where(Expression<Func<T1, T2, T3, T4, T5, T6, bool>> exp);
|
||||
ISelect<T1, T2, T3, T4, T5, T6> WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, T5, T6, bool>> exp);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6> WhereLike(Expression<Func<T1, T2, T3, T4, T5, T6, string[]>> columns, string pattern, bool notLike = false);
|
||||
ISelect<T1, T2, T3, T4, T5, T6> WhereLike(Expression<Func<T1, T2, T3, T4, T5, T6, string>> column, string pattern, bool notLike = false);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6> GroupBy(Expression<Func<T1, T2, T3, T4, T5, T6, object>> columns);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6> OrderBy<TMember>(Expression<Func<T1, T2, T3, T4, T5, T6, TMember>> column);
|
||||
|
@ -15,9 +15,6 @@ namespace FreeSql {
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7> Where(Expression<Func<T1, T2, T3, T4, T5, T6, T7, bool>> exp);
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7> WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, T5, T6, T7, bool>> exp);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7> WhereLike(Expression<Func<T1, T2, T3, T4, T5, T6, T7, string[]>> columns, string pattern, bool notLike = false);
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7> WhereLike(Expression<Func<T1, T2, T3, T4, T5, T6, T7, string>> column, string pattern, bool notLike = false);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7> GroupBy(Expression<Func<T1, T2, T3, T4, T5, T6, T7, object>> columns);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7> OrderBy<TMember>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, TMember>> column);
|
||||
|
@ -15,9 +15,6 @@ namespace FreeSql {
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8> Where(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, bool>> exp);
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8> WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, bool>> exp);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8> WhereLike(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, string[]>> columns, string pattern, bool notLike = false);
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8> WhereLike(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, string>> column, string pattern, bool notLike = false);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8> GroupBy(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, object>> columns);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8> OrderBy<TMember>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, TMember>> column);
|
||||
|
@ -15,9 +15,6 @@ namespace FreeSql {
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> Where(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>> exp);
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>> exp);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> WhereLike(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, string[]>> columns, string pattern, bool notLike = false);
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> WhereLike(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, string>> column, string pattern, bool notLike = false);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> GroupBy(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, object>> columns);
|
||||
|
||||
ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> OrderBy<TMember>(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TMember>> column);
|
||||
|
@ -23,23 +23,6 @@ namespace FreeSql {
|
||||
/// <returns></returns>
|
||||
ISelectFromExpression<T1> WhereIf(bool condition, Expression<Func<T1, bool>> exp);
|
||||
|
||||
/// <summary>
|
||||
/// 模糊查询,选择多个列 OR,WhereLike(a => new[] { a.Title, a.Content }, "%sql%")
|
||||
/// </summary>
|
||||
/// <param name="columns">lambda选择列</param>
|
||||
/// <param name="pattern">查询内容</param>
|
||||
/// <param name="notLike">not like</param>
|
||||
/// <returns></returns>
|
||||
ISelectFromExpression<T1> WhereLike(Expression<Func<T1, string[]>> columns, string pattern, bool notLike = false);
|
||||
/// <summary>
|
||||
/// 模糊查询,WhereLike(a => a.Title, "%sql")
|
||||
/// </summary>
|
||||
/// <param name="column">lambda选择列</param>
|
||||
/// <param name="pattern">查询内容</param>
|
||||
/// <param name="notLike">not like</param>
|
||||
/// <returns></returns>
|
||||
ISelectFromExpression<T1> WhereLike(Expression<Func<T1, string>> column, string pattern, bool notLike = false);
|
||||
|
||||
/// <summary>
|
||||
/// 按选择的列分组,GroupBy(a => a.Name) | GroupBy(a => new{a.Name,a.Time}) | GroupBy(a => new[]{"name","time"})
|
||||
/// </summary>
|
||||
|
46
FreeSql/Interface/Curd/ISelect/ISelectGrouping.cs
Normal file
46
FreeSql/Interface/Curd/ISelect/ISelectGrouping.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
|
||||
namespace FreeSql {
|
||||
public interface ISelectGrouping<T1> {
|
||||
/// <summary>
|
||||
/// 按聚合条件过滤,Where(a => a.Count() > 10)
|
||||
/// </summary>
|
||||
/// <param name="exp">lambda表达式</param>
|
||||
/// <returns></returns>
|
||||
ISelectGrouping<T1> Having(Expression<Func<ISelectGroupingAggregate<T1>, bool>> exp);
|
||||
|
||||
/// <summary>
|
||||
/// 按列排序,OrderBy(a => a.Time)
|
||||
/// </summary>
|
||||
/// <typeparam name="TMember"></typeparam>
|
||||
/// <param name="column"></param>
|
||||
/// <returns></returns>
|
||||
ISelectGrouping<T1> OrderBy<TMember>(Expression<Func<ISelectGroupingAggregate<T1>, TMember>> column);
|
||||
/// <summary>
|
||||
/// 按列倒向排序,OrderByDescending(a => a.Time)
|
||||
/// </summary>
|
||||
/// <param name="column">列</param>
|
||||
/// <returns></returns>
|
||||
ISelectGrouping<T1> OrderByDescending<TMember>(Expression<Func<ISelectGroupingAggregate<T1>, TMember>> column);
|
||||
|
||||
/// <summary>
|
||||
/// 执行SQL查询,返回指定字段的记录,记录不存在时返回 Count 为 0 的列表
|
||||
/// </summary>
|
||||
/// <typeparam name="TReturn">返回类型</typeparam>
|
||||
/// <param name="select">选择列</param>
|
||||
/// <returns></returns>
|
||||
List<TReturn> ToList<TReturn>(Expression<Func<ISelectGroupingAggregate<T1>, TReturn>> select);
|
||||
}
|
||||
|
||||
public interface ISelectGroupingAggregate<T1> {
|
||||
T1 Key { get; set; }
|
||||
int Count();
|
||||
T3 Sum<T3>(T3 column);
|
||||
T3 Avg<T3>(T3 column);
|
||||
T3 Max<T3>(T3 column);
|
||||
T3 Min<T3>(T3 column);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user