2using System.Collections.Generic;
6using System.Data.Entity.Core.EntityClient;
9using System.Data.Entity.SqlServer;
10using System.Data.Entity.Infrastructure;
25 : base(strConnectionString)
35 static Dictionary<int, string> m_rgstrConnections =
new Dictionary<int, string>();
36 static Dictionary<int, ConnectInfo> m_rgciConnections =
new Dictionary<int, ConnectInfo>();
72 if (strServerName ==
"NONE" || strServerName ==
"DEFAULT")
75 string strKey = strDb + strServerName;
76 int nKey = strKey.GetHashCode();
78 if (m_rgstrConnections.ContainsKey(nKey) && m_rgciConnections.ContainsKey(nKey) && m_rgciConnections[nKey].Compare(ci))
79 return m_rgstrConnections[nKey];
81 string strProviderName =
"System.Data.SqlClient";
82 string strDatabaseName = strDb;
83 SqlConnectionStringBuilder sqlBuilder =
new SqlConnectionStringBuilder();
84 EntityConnectionStringBuilder builder =
new EntityConnectionStringBuilder();
86 sqlBuilder.DataSource = strServerName;
87 sqlBuilder.InitialCatalog = strDatabaseName;
89 if (
string.IsNullOrEmpty(ci.
Password))
91 sqlBuilder.IntegratedSecurity =
true;
95 sqlBuilder.PersistSecurityInfo =
false;
98 sqlBuilder.MultipleActiveResultSets =
false;
99 sqlBuilder.Encrypt =
true;
100 sqlBuilder.TrustServerCertificate =
true;
101 sqlBuilder.ConnectTimeout = 180;
104 string strProviderString = sqlBuilder.ToString();
106 builder.Provider = strProviderName;
107 builder.ProviderConnectionString = strProviderString;
108 builder.Metadata =
@"res://*/" + strDb +
"ModelTemporal.csdl|" +
109 "res://*/" + strDb +
"ModelTemporal.ssdl|" +
110 "res://*/" + strDb +
"ModelTemporal.msl";
112 string strConnection = builder.ToString();
114 if (!m_rgstrConnections.ContainsKey(nKey))
115 m_rgstrConnections.Add(nKey, strConnection);
117 m_rgstrConnections[nKey] = strConnection;
119 if (!m_rgciConnections.ContainsKey(nKey))
120 m_rgciConnections.Add(nKey, ci);
122 m_rgciConnections[nKey] = ci;
124 return strConnection;
The ConnectInfo class specifies the server, database and username/password used to connect to a datab...
string Server
Get/set the server.
string Username
Returns the username.
string Database
Get/set the database.
string Password
Returns the password.
The EntitiesConnection class defines how to connect to the database via Entity Frameworks.
static ConnectInfo g_connectInfo
Specifies the default database connection info.
The DNNEntities class defines the entities used to connecto the database via Entity Frameworks.
DNNEntitiesTemporal(string strConnectionString)
The DNNEntities constructor.
The EntitiesConnection class defines how to connect to the database via Entity Frameworks.
static new DNNEntitiesTemporal CreateEntities(ConnectInfo ci=null)
Returns the DNNEntitiesTemporal to use.
static new string CreateConnectionString(ConnectInfo ci)
Creates the connection string used.
EntitiesConnectionTemporal()
The EntitiesConnection constructor.
static new string CreateConnectionString(string strDb)
Creates the connection string used.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe.db.image namespace contains all image database related classes.
The MyCaffe.db.temporal namespace contains all classes used to create the MyCaffeTemporalDatabase in-...
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...