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);
     }
 }
Beispiel #2
0
 internal DbSet(DbSetLogger logger, Expression expression)
 {
     this.logger = logger;
     Expression  = expression;
 }
Beispiel #3
0
 internal DbSet(DbSetLogger logger)
 {
     this.logger = logger;
     Expression  = new UnionExpression(typeof(T));
 }