aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MapperFactory/DataMapperFactory.cs
blob: 8995b9e4b23d601e2965d8cd1e682d9dda273e69 (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.Framework.Data.Base;
using OpenSim.Framework.Data.MSSQLMapper;
using OpenSim.Framework.Data.MySQLMapper;

namespace OpenSim.Framework.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 + "].");
            }            
        }
    }
}