Exemplo n.º 1
0
 /// <summary>
 /// 获取默认业务上下文配置信息
 /// </summary>
 /// <returns></returns>
 protected virtual DbContextConfig GetDefaultDbContextConfig()
 {
     DbContextConfig config=new DbContextConfig()
     {
         ConnectionStringName = "default",
         ContextType = typeof(DefaultDbContext),
         InitializerConfig = new DbContextInitializerConfig()
         {
             InitializerType = typeof(DefaultDbContextInitializer),
             EntityMapperAssemblies = MapperAssemblyFinder.FindAll()
         }
     };
     return config;
 }
Exemplo n.º 2
0
 /// <summary>
 /// 初始化数据上下文
 /// </summary>
 /// <param name="config">数据上下文配置信息</param>
 private static void DbContextInit(DbContextConfig config)
 {
     if (!config.Enabled)
     {
         return;
     }
     DbContextInitializerBase initializer = CreateInitializer(config.InitializerConfig);
     DbContextManager.Instance.RegisterInitializer(config.ContextType, initializer);
 }