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="proxyQueryable"></param> /// <param name="manipulator">First parameter: true for Execute, false for CreateQuery.</param> public ProxyDbSet(DbSet <TEntity> baseDbSet, ProxyQueryable <TEntity> proxyQueryable, Func <bool, Expression, Expression> manipulator) { BaseDbSet = baseDbSet; ProxyQueryable = proxyQueryable; Manipulator = manipulator; if (InternalSetField != null) { InternalSetField.SetValue(this, InternalSetField.GetValue(baseDbSet)); } }