forked from npgsql/npgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNpgsqlProviderObjectFactory.cs
More file actions
34 lines (32 loc) · 1.54 KB
/
NpgsqlProviderObjectFactory.cs
File metadata and controls
34 lines (32 loc) · 1.54 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
using Microsoft.VisualStudio.Data.Framework;
using Microsoft.VisualStudio.Data.Framework.AdoDotNet;
using Microsoft.VisualStudio.Data.Services.SupportEntities;
using System;
using System.Reflection;
using System.Runtime.InteropServices;
namespace Npgsql.VSIX
{
[Guid(Guid)]
class NpgsqlProviderObjectFactory : DataProviderObjectFactory
{
internal const string Guid = "555cd66B-3393-4bab-84d9-3f2caa639699";
public override object CreateObject(Type objType)
{
if (objType == typeof(IVsDataConnectionSupport))
return new AdoDotNetConnectionSupport();
if (objType == typeof(IVsDataConnectionProperties) || objType == typeof(IVsDataConnectionUIProperties))
return new NpgsqlConnectionProperties();
if (objType == typeof(IVsDataConnectionUIControl))
return new NpgsqlConnectionUIControl();
if (objType == typeof(IVsDataSourceInformation))
return new NpgsqlSourceInformation();
if (objType == typeof(IVsDataObjectSupport))
return new DataObjectSupport($"{GetType().Namespace}.NpgsqlDataObjectSupport", Assembly.GetExecutingAssembly());
if (objType == typeof(IVsDataViewSupport))
return new DataViewSupport($"{GetType().Namespace}.NpgsqlDataViewSupport", Assembly.GetExecutingAssembly());
if (objType == typeof(IVsDataConnectionEquivalencyComparer))
return new NpgsqlConnectionEquivalencyComparer();
return null;
}
}
}