Beispiel #1
0
        /// <summary>
        /// 显示配置框
        /// </summary>
        /// <param name="curProject"></param>
        /// <param name="docView"></param>
        /// <param name="dalNamespace"></param>
        public static void ShowConfig(ClassDesignerInfo desinfo, string dalNamespace)
        {
            DBConfigInfo dbinfo = DBConfigInfo.LoadInfo(desinfo);

            using (FrmDBSetting frmSetting = new FrmDBSetting())
            {
                frmSetting._selectedClassDesigner = desinfo;
                if (dbinfo == null)
                {
                    dbinfo             = new DBConfigInfo();
                    dbinfo.DbName      = DBConfigInfo.GetDbName(desinfo);
                    dbinfo.SummaryShow = SummaryShowItem.All;
                    dbinfo.FileName    = DBConfigInfo.GetFileName(desinfo);
                }
                frmSetting.Info        = dbinfo;
                frmSetting.SummaryItem = dbinfo.SummaryShow;
                if (frmSetting.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                if (string.IsNullOrEmpty(dbinfo.AppNamespace))
                {
                    dbinfo.AppNamespace = dalNamespace + "." + dbinfo.DbType;
                }

                dbinfo.SaveConfig(dbinfo.FileName);
                StaticConnection.ClearCacheOperate(dbinfo.DbName);
            }
        }
Beispiel #2
0
        public static DBConfigInfo GetDBConfigInfo(ClassDesignerInfo info, string dalNamespace)
        {
            DBConfigInfo dbinfo = DBConfigInfo.LoadInfo(info);

            if (dbinfo == null)
            {
                using (FrmDBSetting frmSetting = new FrmDBSetting())
                {
                    frmSetting.Info.DbName = DBConfigInfo.GetDbName(info);
                    if (frmSetting.ShowDialog() != DialogResult.OK)
                    {
                        return(null);
                    }
                    dbinfo = frmSetting.Info;

                    dbinfo.AppNamespace = dalNamespace + "." + dbinfo.DbType;
                    dbinfo.FileName     = DBConfigInfo.GetFileName(info);
                    dbinfo.SaveConfig(dbinfo.FileName);
                    StaticConnection.ClearCacheOperate(dbinfo.DbName);
                }
            }
            return(dbinfo);
        }