aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MapperFactory/DataMapperFactory.cs
blob: 79c85f82890890498cb9ee362803b1a1e7dea7f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
using OpenSim.Data.Base;
using OpenSim.Data.MSSQLMapper;
using OpenSim.Data.MySQLMapper;

namespace OpenSim.Data.MapperFactory
{
    public class DataMapperFactory
    {
        public enum MAPPER_TYPE {
            MySQL,
            MSSQL,
        };

        static public BaseDatabaseConnector GetDataBaseMapper(MAPPER_TYPE type, string connectionString)
        {
            switch (type) {
                case MAPPER_TYPE.MySQL:
                    return new MySQLDatabaseMapper(connectionString);
                case MAPPER_TYPE.MSSQL:
                    return new MSSQLDatabaseMapper(connectionString);
                default:
                    throw new ArgumentException("Unknown Database Mapper type [" + type + "].");
            }            
        }
    }
}