示例#1
0
 protected BaseRepository(IFreeSql fsql, Expression <Func <TEntity, bool> > filter, Func <string, string> asTable = null)
 {
     _ormScoped = DbContextScopedFreeSql.Create(fsql, () => _db, () => UnitOfWork);
     DataFilterUtil.SetRepositoryDataFilter(this, null);
     DataFilter.Apply("", filter);
     AsTable(asTable);
 }
示例#2
0
 protected BaseRepository(IFreeSql fsql, Expression <Func <TEntity, bool> > filter, Func <string, string> asTable = null)
 {
     Orm = fsql;
     DataFilterUtil.SetRepositoryDataFilter(this, null);
     DataFilter.Apply("", filter);
     AsTable(asTable);
 }
示例#3
0
        protected BaseRepository(IFreeSql fsql, Expression <Func <TEntity, bool> > filter, Func <string, string> asTable = null)
        {
            _ormScoped = DbContextScopedFreeSql.Create(fsql, () => _db, () => UnitOfWork);
            DataFilterUtil.SetRepositoryDataFilter(this, null);
            DataFilter.Apply("", filter);
            AsTable(asTable);

            fsql.GlobalFilter.GetFilters().ForEach(gf =>
            {
                (DataFilter as DataFilter <TEntity>)._filtersByOrm.TryAdd(gf.Name, new DataFilter <TEntity> .FilterItemByOrm
                {
                    Filter    = gf,
                    IsEnabled = true
                });
            });
        }
示例#4
0
 protected void ApplyDataFilter(string name, Expression <Func <TEntity, bool> > exp) => DataFilter.Apply(name, exp);