/
dev-npgsql
/
npgsql
Обзор
Документация
Войти
/
dev-npgsql
/
npgsql
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
v4.1.13
src/VSIX/NpgsqlConnectionProperties.cs
35 строк
1 KB
Shay Rojansky
[VSIX] Tiny cleanup
26 янв 2018, 04:58
26 янв 2018, 04:58
259fb99
Код
Авторство
О чём код?
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Reflection; using Microsoft.VisualStudio.Data.Framework.AdoDotNet; namespace Npgsql.VSIX { public class NpgsqlConnectionProperties : AdoDotNetConnectionProperties { static readonly Dictionary<string, string[]> Synonyms; public override bool IsComplete => !string.IsNullOrEmpty((string)this["Host"]) && !string.IsNullOrEmpty((string)this["Database"]) && ( (bool)this["Integrated Security"] || (!string.IsNullOrEmpty((string)this["Username"]) && !string.IsNullOrEmpty((string)this["Password"])) ); public override string[] GetSynonyms(string key) => Synonyms[key]; static NpgsqlConnectionProperties() { Synonyms = typeof(NpgsqlConnectionStringBuilder) .GetProperties() .Where(p => p.GetCustomAttribute<NpgsqlConnectionStringPropertyAttribute>() != null) .ToDictionary( p => p.GetCustomAttribute<DisplayNameAttribute>().DisplayName, p => p.GetCustomAttribute<NpgsqlConnectionStringPropertyAttribute>().Synonyms ); } } }