Exemple #1
0
        private static Dictionary <string, DbUtility> LoadDatabaseList()
        {
            DatabaseList list =
                SerializerProvider.SerializerHelper <DatabaseList> .LoadFromXmlFile(Configer.ServerListFileLocation);

            if (list == null || list.Databases == null || list.Databases.Length == 0)
            {
                throw new DatabaseNotSpecifiedException();
            }

            var hashtable = new Dictionary <string, DbUtility>(list.Databases.Length);

            foreach (DatabaseMajor instance in list.Databases)
            {
                DbUtility database = VisitorFactory.CreateComDataVisitor(instance.Connection.DataProvider.Value);
                database.Provider   = instance.Connection.DataProvider.Value;
                database.DataServer = instance.Connection.DataServer.Value;
                database.DataSource = instance.Connection.DataSource.Value;
                database.UserID     = instance.Connection.DataUserID.Value;
                database.Password   = instance.Connection.DataPassword.Value;
                database.Initialize();
                //TODO:此处应解析Password
                hashtable.Add(instance.Name.ToUpper(), database);
            }

            return(hashtable);
        }
Exemple #2
0
 public EasySpecify()
 {
     ComDataVisitor = VisitorFactory.CreateComDataVisitor();
     if (ComDataVisitor == null || !ComDataVisitor.Initialize())
     {
         throw new Exception("业务实体创建失败");
     }
 }