init
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
namespace DbAPI.Connections
|
||||
{
|
||||
/// <summary>
|
||||
/// Basic implementation of <see cref="IConnectionDetails"/>
|
||||
/// <inheritdoc cref="IConnectionDetails" />
|
||||
/// </summary>
|
||||
public class ConnectionDetails : IConnectionDetails
|
||||
{
|
||||
public virtual bool UseNTLMAuthentication { get; set; } = true;
|
||||
public virtual string DbUser { get; set; } = "DataPROUser";
|
||||
public virtual string DbUserPassword { get; set; } = "DTSSealBeachHQ";
|
||||
public virtual string InstanceName { get; set; } = "DataPROInstance";
|
||||
public virtual string DbServer { get; set; } = @"(localdb)\DataPROInstance";
|
||||
public virtual string DbName { get; set; } = "DataPRO";
|
||||
public virtual bool UsingCentralizedDb { get; set; } = false;
|
||||
public virtual string DbFolderPath { get; set; } = "";
|
||||
public virtual string AttachDbsBatPath { get; set; } = "";
|
||||
public virtual string SqlDbPath { get; set; } = "";
|
||||
public virtual string ODBCToolsPath { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// holds the code version of the database, what we would use if available
|
||||
/// should be initialized by clients
|
||||
/// </summary>
|
||||
public int ClientDbVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// holds the version of the database, what we will be using
|
||||
/// should be initialized by clients
|
||||
/// </summary>
|
||||
public int ConnectionDbVersion { get; set; }
|
||||
protected string _Connection = null;
|
||||
public virtual string GetConnectionString()
|
||||
{
|
||||
if (null != _Connection) { return _Connection; }
|
||||
|
||||
_Connection = UseNTLMAuthentication
|
||||
? $"Server={DbServer};Database={DbName};Trusted_Connection=TRUE;"
|
||||
: $"Server={DbServer};Database={DbName};User Id={DbUser};Password={DbUserPassword};";
|
||||
|
||||
return _Connection;
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return UsingCentralizedDb ? $"{DbServer}\\{DbName}" : $"Local\\{DbName}";
|
||||
}
|
||||
public ConnectionDetails() { }
|
||||
public ConnectionDetails(ConnectionDetails details)
|
||||
{
|
||||
UseNTLMAuthentication = details.UseNTLMAuthentication;
|
||||
DbUser = details.DbUser;
|
||||
DbUserPassword = details.DbUserPassword;
|
||||
InstanceName = details.InstanceName;
|
||||
DbServer = details.DbServer;
|
||||
DbName = details.DbName;
|
||||
UsingCentralizedDb = details.UsingCentralizedDb;
|
||||
DbFolderPath = details.DbFolderPath;
|
||||
AttachDbsBatPath = details.AttachDbsBatPath;
|
||||
SqlDbPath = details.SqlDbPath;
|
||||
ODBCToolsPath = details.ODBCToolsPath;
|
||||
_Connection = details._Connection;
|
||||
ClientDbVersion = details.ClientDbVersion;
|
||||
ConnectionDbVersion = details.ConnectionDbVersion;
|
||||
}
|
||||
|
||||
public virtual IConnectionDetails Clone()
|
||||
{
|
||||
return new ConnectionDetails(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user