diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-20 14:24:19 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-20 14:24:19 +0200 |
| commit | e0b0859f62924d38c8cd7ac9975303c4bfb08624 (patch) | |
| tree | 6c6b0d45cf2ed76e3d6405a5fb512ba4cba95288 /Software/Visual_Studio/Tango.Core | |
| parent | d204e56c57dcf52f31c9e64222f32a678150e721 (diff) | |
| download | Tango-e0b0859f62924d38c8cd7ac9975303c4bfb08624.tar.gz Tango-e0b0859f62924d38c8cd7ac9975303c4bfb08624.zip | |
Added environments support for users & roles !!
Diffstat (limited to 'Software/Visual_Studio/Tango.Core')
| -rw-r--r-- | Software/Visual_Studio/Tango.Core/DB/DbManager.cs | 5 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.Core/DataSource.cs | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Core/DB/DbManager.cs b/Software/Visual_Studio/Tango.Core/DB/DbManager.cs index 0a9123164..1d90b30e8 100644 --- a/Software/Visual_Studio/Tango.Core/DB/DbManager.cs +++ b/Software/Visual_Studio/Tango.Core/DB/DbManager.cs @@ -41,6 +41,11 @@ namespace Tango.Core.DB return new DbManager(new SqlConnection(String.Format("Server={0};Integrated security=SSPI;Initial Catalog={1}", address, database))); } + public static DbManager FromDataSource(DataSource dataSource) + { + return new DbManager(dataSource.ToConnection() as SqlConnection); + } + public static DbManager FromCredentials(String address, String database, String userName, String password) { return new DbManager(new SqlConnection(String.Format("Server={0};Initial Catalog={1};User Id={2};Password={3}", address, database, userName, password))); diff --git a/Software/Visual_Studio/Tango.Core/DataSource.cs b/Software/Visual_Studio/Tango.Core/DataSource.cs index c5c58cf09..fd7d5e3ec 100644 --- a/Software/Visual_Studio/Tango.Core/DataSource.cs +++ b/Software/Visual_Studio/Tango.Core/DataSource.cs @@ -66,6 +66,7 @@ namespace Tango.Core /// <returns></returns> public DbConnection ToConnection() { + switch (Type) { case DataSourceType.SQLite: @@ -121,5 +122,16 @@ namespace Tango.Core return null; } } + + /// <summary> + /// Returns a <see cref="System.String" /> that represents this instance. + /// </summary> + /// <returns> + /// A <see cref="System.String" /> that represents this instance. + /// </returns> + public override string ToString() + { + return $"{Address}\\{Catalog}"; + } } } |
