public ProxyDbSet(DbSet <TEntity> baseDbSet, Func <Expression, Expression> manipulator = null) { IQueryProvider provider = ((IQueryable)baseDbSet).Provider; ProxyDbProvider proxyDbProvider = new ProxyDbProvider(provider, manipulator); ProxyQueryable = (ProxyQueryable <TEntity>)(proxyDbProvider.CreateQuery <TEntity>(((IQueryable)baseDbSet).Expression)); }
/// <summary> /// /// </summary> /// <param name="baseDbSet"></param> /// <param name="manipulator">First parameter: true for Execute, false for CreateQuery.</param> public ProxyDbSet(DbSet <TEntity> baseDbSet, Func <bool, Expression, Expression> manipulator) { BaseDbSet = baseDbSet; IQueryProvider provider = ((IQueryable)baseDbSet).Provider; ProxyDbProvider proxyDbProvider = new ProxyDbProvider(provider, manipulator); ProxyQueryable = proxyDbProvider.CreateQuery <TEntity>(((IQueryable)baseDbSet).Expression); Manipulator = manipulator; if (InternalSetField != null) { InternalSetField.SetValue(this, InternalSetField.GetValue(baseDbSet)); } }