2 // Mono.Data.Provider
\r
5 // Brian Ritchie (brianlritchie@hotmail.com)
\r
8 // Copyright (C) Brian Ritchie, 2002
\r
13 using System.Reflection;
\r
17 public class Provider
\r
19 private string name = null;
\r
20 private string connectionTypeName;
\r
21 private string adapterTypeName;
\r
22 private string commandTypeName;
\r
23 private Type connectionType;
\r
24 private Type adapterType;
\r
25 private Type commandType;
\r
26 private string assemblyName;
\r
27 private string description;
\r
29 public Provider(string _name, string _connection,
\r
30 string _dataadapter, string _command, string _assembly,
\r
31 string _description)
\r
34 connectionTypeName = _connection;
\r
35 adapterTypeName = _dataadapter;
\r
36 assemblyName = _assembly;
\r
37 commandTypeName = _command;
\r
38 description = _description;
\r
41 public Provider(string _name, Type _connection, Type _dataadapter, Type _command,
\r
42 string _description)
\r
45 connectionTypeName = _connection.FullName;
\r
46 adapterTypeName = _dataadapter.FullName;
\r
47 commandTypeName = _command.FullName;
\r
48 connectionType = _connection;
\r
49 adapterType = _dataadapter;
\r
50 commandType = _command;
\r
51 description = _description;
\r
59 public string Description
\r
61 get {return description;}
\r
64 public Type ConnectionType
\r
68 if (connectionType==null)
\r
70 connectionType=Type.GetType(connectionTypeName+","+assemblyName);
\r
72 return connectionType;
\r
76 public Type DataAdapterType
\r
80 if (adapterType==null)
\r
82 adapterType=Type.GetType(adapterTypeName+","+assemblyName);
\r
88 public Type CommandType
\r
92 if (commandType==null)
\r
94 commandType=Type.GetType(commandTypeName+","+assemblyName);
\r
100 public IDbConnection CreateConnection()
\r
102 return (IDbConnection) Activator.CreateInstance(ConnectionType);
\r
105 public IDbDataAdapter CreateDataAdapter()
\r
107 return (IDbDataAdapter) Activator.CreateInstance(DataAdapterType);
\r
110 public IDbCommand CreateCommand()
\r
112 return (IDbCommand) Activator.CreateInstance(CommandType);
\r