/// <summary> /// 合并两个仓储的设置(过滤+分表),以便查询 /// </summary> /// <typeparam name="TEntity"></typeparam> /// <typeparam name="T2"></typeparam> /// <param name="that"></param> /// <param name="repos"></param> /// <returns></returns> public static ISelect <TEntity> FromRepository <TEntity, T2>(this ISelect <TEntity> that, BaseRepository <T2> repos) where TEntity : class where T2 : class { var filters = (repos.DataFilter as DataFilter <T2>)._filters.Where(a => a.Value.IsEnabled == true); foreach (var filter in filters) { that.Where <T2>(filter.Value.Expression); } return(that.AsTable(repos.AsTableSelectInternal)); }
public static ISelect <T> AsTable <T>(this ISelect <T> @this, string tableName, int count) where T : class { string[] tableNames = new string[] { }; for (int i = 0; i < count; i++) { tableNames.AddIfNotContains($"{tableName}_{i}"); } @this.AsTable(tableNames); return(@this); }
public static ISelect <T> AsTable <T>(this ISelect <T> @this, params string[] tableNames) where T : class { tableNames?.ToList().ForEach(tableName => { @this.AsTable((type, oldname) => { if (type == typeof(T)) { return(tableName); } return(null); }); }); return(@this); }
/// <summary> /// 合并两个仓储的设置,以便查询 /// </summary> /// <typeparam name="TEntity"></typeparam> /// <typeparam name="T2"></typeparam> /// <param name="that"></param> /// <param name="repos"></param> /// <returns></returns> public static ISelect <TEntity> FromRepository <TEntity, T2>(this ISelect <TEntity> that, BaseRepository <T2> repos) where TEntity : class where T2 : class { return(that.AsTable(repos.AsTableSelectInternal).Where <T2>(repos.FilterInternal)); }