public static SQLServerContext CreateSQLDatabaseContext(string database)
        {
            database = (database == null) ? DataConfig.SQLConfig.InitialCatalog : database;
            SQLServerContext context = new SQLServerContext(database);

            return(context);
        }
Exemple #2
0
        public static IDataController CreateDataController(string database)
        {
            if (string.IsNullOrWhiteSpace(database))
            {
                throw new ArgumentNullException("database");
            }

            switch (DataConfig.DatabaseType)
            {
            case DataType.SQL:

                SQLServerContext  context    = DatabaseContextFactory.CreateSQLDatabaseContext(database);
                SQLDataController controller = new SQLDataController(context);
                return(controller);

            //case Configurations.DatabaseType.MySQL:
            //	MySQLLoaderFactory mySQLLoaderFactory = new MySQLDataLoaderFactory();
            //	MySqlConnection context = CreateMySQLDatabaseContext(database);
            //	return loaderFactory.CreateDataLoader(DataType, context);


            default:
                throw new UnsupportedEngineTypeException("database type");
            }
        }
Exemple #3
0
 public SQLCSVDataLoader(SQLServerContext context)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     this.context = context;
 }
Exemple #4
0
        public static IDataLoader CreateDataLoader(DataType type, SQLServerContext context)
        {
            switch (type)
            {
            case DataType.BAK:
                return(new SQLBAKDataLoader(context));

            case DataType.CSV:
                return(new SQLCSVDataLoader(context));

            case DataType.XML:
                return(new SQLXMLDataLoader(context));

            default:
                throw new ArgumentException("DataType " + type + " not supported");
            }
        }
Exemple #5
0
        public static IDataLoader CreateDataLoader(DataType dataType, string database)
        {
            if (string.IsNullOrWhiteSpace(database))
            {
                throw new ArgumentNullException("database");
            }

            switch (DataConfig.DatabaseType)
            {
            case DataType.SQL:
                SQLServerContext context = DatabaseContextFactory.CreateSQLDatabaseContext(database);
                IDataLoader      loader  = SQLDataLoaderFactory.CreateDataLoader(dataType, context);
                return(loader);

            default:
                throw new UnsupportedEngineTypeException("database");
            }
        }