public DbContext(string connectionString) { Proxy = new DbProxy(connectionString); foreach (var property in GetType().GetProperties()) { var type = property.PropertyType; if (type.Name != typeof(DbSet <>).Name) { continue; } models.Add(type.GenericTypeArguments[0]); var logger = new DbSetLogger(Proxy); property.SetValue(this, Activator.CreateInstance(type, BindingFlags.Instance | BindingFlags.NonPublic, null, new object[] { logger }, null)); loggers.Add(logger); } }
internal DbSet(DbSetLogger logger, Expression expression) { this.logger = logger; Expression = expression; }
internal DbSet(DbSetLogger logger) { this.logger = logger; Expression = new UnionExpression(typeof(T)); }