forked from danbarua/Npgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNpgsqlDataConnectionSupport.cs
More file actions
61 lines (52 loc) · 1.91 KB
/
NpgsqlDataConnectionSupport.cs
File metadata and controls
61 lines (52 loc) · 1.91 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
/********************************************************
* 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 Npgsql.Designer
{
using System;
using Microsoft.VisualStudio.Data;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Data.AdoDotNet;
using Microsoft.Win32;
/// <summary>
/// This class creates many of the DDEX components when asked for by the server explorer.
/// </summary>
internal sealed class NpgsqlDataConnectionSupport : AdoDotNetConnectionSupport
{
private NpgsqlDataViewSupport _dataViewSupport;
private NpgsqlDataObjectSupport _dataObjectSupport;
private NpgsqlDataObjectIdentifierResolver _dataObjectIdentifierResolver;
public NpgsqlDataConnectionSupport()
: base("Npgsql")
{
}
protected override DataSourceInformation CreateDataSourceInformation()
{
return new NpgsqlDataSourceInformation(Site as DataConnection);
}
protected override object GetServiceImpl(Type serviceType)
{
if (serviceType == typeof(DataViewSupport))
{
if (_dataViewSupport == null) _dataViewSupport = new NpgsqlDataViewSupport();
return _dataViewSupport;
}
if (serviceType == typeof(DataObjectSupport))
{
if (_dataObjectSupport == null) _dataObjectSupport = new NpgsqlDataObjectSupport();
return _dataObjectSupport;
}
if (serviceType == typeof(DataObjectIdentifierResolver))
{
if (_dataObjectIdentifierResolver == null) _dataObjectIdentifierResolver = new NpgsqlDataObjectIdentifierResolver(Site);
return _dataObjectIdentifierResolver;
}
if (serviceType == typeof(DataConnectionSupport))
return this;
return base.GetServiceImpl(serviceType);
}
}
}