示例#1
0
        public static TkDbContext CreateDefault()
        {
            ISupportDbContext support = GetSupport();
            DbContextConfig   config  = support.Default;

            TkDebug.AssertNotNull(config, "AppSetting中没有配置Default的DbContext", support);
            return(config.CreateDbContext());
        }
示例#2
0
        public static TkDbContext CreateDbContext(string name)
        {
            TkDebug.AssertArgumentNullOrEmpty(name, "name", null);

            ISupportDbContext support = GetSupport();
            DbContextConfig   config  = support.GetContextConfig(name);

            TkDebug.AssertNotNull(config, string.Format(ObjectUtil.SysCulture,
                                                        "AppSetting中没有配置名称为{0}的DbContext", name), support);

            return(config.CreateDbContext());
        }