Skip to content

Commit

Permalink
Moved the connection info type into own class
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Pouwels committed Oct 14, 2020
1 parent 89b67f4 commit 8c7a99e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Demo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static void Main(string[] args)

// Step 5: Print the connection info
var conStringInfo =
connector.ConnectionStringInfo(Helper.ConnectionInfoType.Server | Helper.ConnectionInfoType.Database);
connector.ConnectionStringInfo(ConnectionInfoType.Server | ConnectionInfoType.Database);
Console.WriteLine($"Connection: {conStringInfo}");

Console.WriteLine("Done");
Expand Down
36 changes: 36 additions & 0 deletions ZimLabs.Database.MySql/ConnectionInfoType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;

namespace ZimLabs.Database.MySql
{
/// <summary>
/// Provides the different connection info types
/// </summary>
[Flags]
public enum ConnectionInfoType
{
/// <summary>
/// Shows nothing
/// </summary>
None = 0,

/// <summary>
/// Shows the name of the server
/// </summary>
Server = 1,

/// <summary>
/// Shows the name of the database
/// </summary>
Database = 2,

/// <summary>
/// Shows the user name
/// </summary>
User = 4,

/// <summary>
/// Shows the port number
/// </summary>
Port = 8
}
}
2 changes: 1 addition & 1 deletion ZimLabs.Database.MySql/Connector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void SwitchDatabase(string database)
/// </summary>
/// <param name="type">The type</param>
/// <returns>The connection string info</returns>
public string ConnectionStringInfo(Helper.ConnectionInfoType type)
public string ConnectionStringInfo(ConnectionInfoType type)
{
var server = $"Server: {_settings.Server}";
var database = $"Database: {_settings.Database}";
Expand Down
31 changes: 0 additions & 31 deletions ZimLabs.Database.MySql/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,6 @@ namespace ZimLabs.Database.MySql
/// </summary>
public static class Helper
{
/// <summary>
/// Provides the different connection info types
/// </summary>
[Flags]
public enum ConnectionInfoType
{
/// <summary>
/// Shows nothing
/// </summary>
None = 0,

/// <summary>
/// Shows the name of the server
/// </summary>
Server = 1,

/// <summary>
/// Shows the name of the database
/// </summary>
Database = 2,

/// <summary>
/// Shows the user name
/// </summary>
User = 4,

/// <summary>
/// Shows the port number
/// </summary>
Port = 8
}
/// <summary>
/// Converts a secure string into a normal string
/// </summary>
Expand Down
12 changes: 8 additions & 4 deletions ZimLabs.Database.MySql/ZimLabs.Database.MySql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@
<RepositoryUrl>https://github.com/InvaderZim85/ZimLabs.Database.MySql</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>Helper, Database, MySql, Connector</PackageTags>
<Version>1.0.4</Version>
<PackageReleaseNotes>Added possibility to get the connection string info</PackageReleaseNotes>
<AssemblyVersion>1.0.4.0</AssemblyVersion>
<FileVersion>1.0.4.0</FileVersion>
<Version>1.1.0</Version>
<PackageReleaseNotes>Moved the enum into own class</PackageReleaseNotes>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>D:\Repositories\NuGet_Packages\ZimLabs.Database.MySql\ZimLabs.Database.MySql\ZimLabs.Database.MySql.xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
<None Remove="ZimLabs.Database.MySql.xml" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="MySql.Data" Version="8.0.19" />
</ItemGroup>
Expand Down

0 comments on commit 8c7a99e

Please sign in to comment.