Esempio n. 1
0
        public void InitDb()
        {
            //连接状态记录表,检测实体关系模型是否与数据库匹配
            //若表不存在则初始化数据表
            if (dbServer.IsTableExist("_relationState"))
            {
                //存在,验证是否匹配
            }
            else
            {
                //不存在,实例化关系模型(建表)
                foreach (var r in mappingDataSet.GetAllRelations())
                {
                    dbServer.CreateTable(r);
                }

                //最后建立relationState表
                dbServer.CreateTable(mappingDataSet.GetRelationState());
            }
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            DbServerBase A = new DbServerBase("123");

            try
            {
                List <RelationModel> relations = new ModelUtil(typeof(Student)).GetRelations();
                A.CreateTable(relations[0]);
            }
            catch (Exception ex)
            {
                var a = ex.Message;
                //4060
                a = null;
            }
            return;
        }