* Makefile: Build the make-map.exe in Mono.Unix.Native; add /nowarn:0618 to
[mono.git] / mcs / class / FirebirdSql.Data.Firebird / FirebirdSql.Data.Firebird / ClientFactory.cs
1 /*
2  *      Firebird ADO.NET Data provider for .NET and Mono 
3  * 
4  *         The contents of this file are subject to the Initial 
5  *         Developer's Public License Version 1.0 (the "License"); 
6  *         you may not use this file except in compliance with the 
7  *         License. You may obtain a copy of the License at 
8  *         http://www.firebirdsql.org/index.php?op=doc&id=idpl
9  *
10  *         Software distributed under the License is distributed on 
11  *         an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
12  *         express or implied. See the License for the specific 
13  *         language governing rights and limitations under the License.
14  * 
15  *      Copyright (c) 2002, 2005 Carlos Guzman Alvarez
16  *      All Rights Reserved.
17  */
18
19 using System;
20 using FirebirdSql.Data.Common;
21
22 namespace FirebirdSql.Data.Firebird
23 {
24         internal sealed class ClientFactory
25         {
26                 #region Constructors
27
28                 private ClientFactory()
29                 {
30                 }
31
32                 #endregion
33
34                 #region Static Methods
35
36                 public static IDatabase CreateDatabase(int serverType)
37                 {
38                         switch (serverType)
39                         {
40                                 case 0:
41                                         // C# Client
42                                         return new FirebirdSql.Data.Gds.GdsDatabase();
43
44 #if     (!NETCF)
45
46                                 case 1:
47                                         // PInvoke Client
48                                         return new FirebirdSql.Data.Embedded.FesDatabase();
49
50 #endif
51
52                                 default:
53                                         throw new NotSupportedException("Specified server type is not correct.");
54                         }
55                 }
56
57                 public static IServiceManager CreateServiceManager(int serverType)
58                 {
59                         switch (serverType)
60                         {
61                                 case 0:
62                                         // C# Client
63                                         return new FirebirdSql.Data.Gds.GdsServiceManager();
64
65 #if     (!NETCF)
66
67                                 case 1:
68                                         // PInvoke Client
69                                         return new FirebirdSql.Data.Embedded.FesServiceManager();
70
71 #endif
72
73                                 default:
74                                         throw new NotSupportedException("Specified server type is not correct.");
75                         }
76                 }
77
78                 #endregion
79         }
80 }