Ejemplo n.º 1
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());
        }
Ejemplo n.º 2
0
        public static DbContextConfig GetDbContextConfig(string name)
        {
            ISupportDbContext support = GetSupport();

            if (string.IsNullOrEmpty(name))
            {
                return(support.Default);
            }
            else
            {
                return(support.GetContextConfig(name));
            }
        }
Ejemplo n.º 3
0
        protected override object InternalConvertFromString(string text, ReadSettings settings)
        {
            ISupportDbContext support = BaseAppSetting.Current as ISupportDbContext;

            if (support == null)
            {
                return(null);
            }

            if (string.IsNullOrEmpty(text))
            {
                return(support.Default);
            }
            return(support.GetContextConfig(text));
        }