DataMapperFactory.cs 840 B

123456789101112131415161718192021222324252627
  1. using System;
  2. using OpenSim.Framework.Data.Base;
  3. using OpenSim.Framework.Data.MSSQLMapper;
  4. using OpenSim.Framework.Data.MySQLMapper;
  5. namespace OpenSim.Framework.Data.MapperFactory
  6. {
  7. public class DataMapperFactory
  8. {
  9. public enum MAPPER_TYPE {
  10. MySQL,
  11. MSSQL,
  12. };
  13. static public BaseDatabaseConnector GetDataBaseMapper(MAPPER_TYPE type, string connectionString)
  14. {
  15. switch (type) {
  16. case MAPPER_TYPE.MySQL:
  17. return new MySQLDatabaseMapper(connectionString);
  18. case MAPPER_TYPE.MSSQL:
  19. return new MSSQLDatabaseMapper(connectionString);
  20. default:
  21. throw new ArgumentException("Unknown Database Mapper type [" + type + "].");
  22. }
  23. }
  24. }
  25. }