[d2857c]: System.Data.SQLite / LINQ / SQLiteFactory_Linq.cs  Maximize  Restore  History

Download this file

67 lines (60 with data), 2.5 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
/********************************************************
* 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!
********************************************************/
using System.Reflection;
using System.Security.Permissions;
namespace System.Data.SQLite
{
/// <summary>
/// SQLite implementation of DbProviderFactory.
/// </summary>
public sealed partial class SQLiteFactory : IServiceProvider
{
private static readonly Type _dbProviderServicesType;
private static object _sqliteServices;
static SQLiteFactory()
{
_dbProviderServicesType =
Type.GetType(
"System.Data.Common.DbProviderServices, System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
false);
}
#region IServiceProvider Members
/// <summary>
/// Will provide a DbProviderServices object in .NET 3.5
/// </summary>
/// <param name="serviceType">The class or interface type to query for</param>
/// <returns></returns>
object IServiceProvider.GetService(Type serviceType)
{
if (serviceType == typeof (ISQLiteSchemaExtensions) ||
(_dbProviderServicesType != null && serviceType == _dbProviderServicesType))
{
return GetSQLiteProviderServicesInstance();
}
return null;
}
#endregion
[ReflectionPermission(SecurityAction.Assert, MemberAccess = true)]
private object GetSQLiteProviderServicesInstance()
{
if (_sqliteServices == null)
{
Type type =
Type.GetType(
"System.Data.SQLite.SQLiteProviderServices, System.Data.SQLite.Linq, Version=2.0.38.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139",
false);
if (type != null)
{
FieldInfo field = type.GetField("Instance",
BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
_sqliteServices = field.GetValue(null);
}
}
return _sqliteServices;
}
}
}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks