-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQLiteFactory.cs
More file actions
executable file
·169 lines (148 loc) · 4.92 KB
/
Copy pathSQLiteFactory.cs
File metadata and controls
executable file
·169 lines (148 loc) · 4.92 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/********************************************************
* ADO.NET 2.0 Data Provider for SQLite Version 3.X
* Written by Robert Simpson (robert@blackcastlesoft.com)
*
* Released to the public domain, use at your own risk!
********************************************************/
namespace System.Data.SQLite
{
using System;
using System.Data.Common;
#if !PLATFORM_COMPACTFRAMEWORK
/// <summary>
/// SQLite implementation of <see cref="DbProviderFactory" />.
/// </summary>
public sealed partial class SQLiteFactory : DbProviderFactory, IDisposable
{
/// <summary>
/// Constructs a new instance.
/// </summary>
public SQLiteFactory()
{
//
// NOTE: Do nothing here now. All the logging setup related code has
// been moved to the new SQLiteLog static class.
//
}
///////////////////////////////////////////////////////////////////////////////////////////////
#region IDisposable Members
/// <summary>
/// Cleans up resources (native and managed) associated with the current instance.
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////
#region IDisposable "Pattern" Members
private bool disposed;
private void CheckDisposed() /* throw */
{
#if THROW_ON_DISPOSED
if (disposed)
throw new ObjectDisposedException(typeof(SQLiteFactory).Name);
#endif
}
///////////////////////////////////////////////////////////////////////////////////////////////
private void Dispose(bool disposing)
{
if (!disposed)
{
//if (disposing)
//{
// ////////////////////////////////////
// // dispose managed resources here...
// ////////////////////////////////////
//}
//////////////////////////////////////
// release unmanaged resources here...
//////////////////////////////////////
disposed = true;
}
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////
#region Destructor
/// <summary>
/// Cleans up resources associated with the current instance.
/// </summary>
~SQLiteFactory()
{
Dispose(false);
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// This event is raised whenever SQLite raises a logging event.
/// Note that this should be set as one of the first things in the
/// application. This event is provided for backward compatibility only.
/// New code should use the <see cref="SQLiteLog" /> class instead.
/// </summary>
public event SQLiteLogEventHandler Log
{
add { CheckDisposed(); SQLiteLog.Log += value; }
remove { CheckDisposed(); SQLiteLog.Log -= value; }
}
/// <summary>
/// Static instance member which returns an instanced <see cref="SQLiteFactory" /> class.
/// </summary>
public static readonly SQLiteFactory Instance = new SQLiteFactory();
/// <summary>
/// Creates and returns a new <see cref="SQLiteCommand" /> object.
/// </summary>
/// <returns>The new object.</returns>
public override DbCommand CreateCommand()
{
CheckDisposed();
return new SQLiteCommand();
}
/// <summary>
/// Creates and returns a new <see cref="SQLiteCommandBuilder" /> object.
/// </summary>
/// <returns>The new object.</returns>
public override DbCommandBuilder CreateCommandBuilder()
{
CheckDisposed();
return new SQLiteCommandBuilder();
}
/// <summary>
/// Creates and returns a new <see cref="SQLiteConnection" /> object.
/// </summary>
/// <returns>The new object.</returns>
public override DbConnection CreateConnection()
{
CheckDisposed();
return new SQLiteConnection();
}
/// <summary>
/// Creates and returns a new <see cref="SQLiteConnectionStringBuilder" /> object.
/// </summary>
/// <returns>The new object.</returns>
public override DbConnectionStringBuilder CreateConnectionStringBuilder()
{
CheckDisposed();
return new SQLiteConnectionStringBuilder();
}
/// <summary>
/// Creates and returns a new <see cref="SQLiteDataAdapter" /> object.
/// </summary>
/// <returns>The new object.</returns>
public override DbDataAdapter CreateDataAdapter()
{
CheckDisposed();
return new SQLiteDataAdapter();
}
/// <summary>
/// Creates and returns a new <see cref="SQLiteParameter" /> object.
/// </summary>
/// <returns>The new object.</returns>
public override DbParameter CreateParameter()
{
CheckDisposed();
return new SQLiteParameter();
}
}
#endif
}