public static TkDbContext CreateDefault() { ISupportDbContext support = GetSupport(); DbContextConfig config = support.Default; TkDebug.AssertNotNull(config, "AppSetting中没有配置Default的DbContext", support); return(config.CreateDbContext()); }
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()); }