1#if !NETSTANDARD2_0 && !NET5_0 && !NET6_0
11using System.Data.Objects;
36 where C : ObjectContext
38 private static object _lock =
new object();
40 private string _connectionString;
41 private string _label;
87 return GetManager(database, isDatabaseName,
"default");
109 var connection = ConfigurationManager.ConnectionStrings[database];
110 if (connection ==
null)
112 var conn = ConfigurationManager.ConnectionStrings[database].ConnectionString;
113 if (
string.IsNullOrEmpty(conn))
120 var contextLabel = GetContextName(database, label);
140 _connectionString = connectionString;
143 _context.Connection.Open();
146 private static string GetContextName(
string connectionString,
string label)
148 return "__octx:" + label +
"-" + connectionString;
163#region Reference counting
165 private int _refCount;
173 get {
return _refCount; }
176 private void AddRef()
189 _context.Connection.Close();
Provides consistent context information between the client and server DataPortal objects.
object CreateInstanceDI(Type objectType, params object[] parameters)
Creates an object using 'Activator.CreateInstance' using service provider (if one is available) to po...
ApplicationContext(ApplicationContextAccessor applicationContextAccessor)
Creates a new instance of the type
ContextDictionary LocalContext
Returns the application-specific context data that is local to the current AppDomain.
Provides an automated way to reuse Entity Framework object context objects within the context of a si...
ObjectContextManager< C > GetManager(string database, string label)
Gets the ObjectContextManager object for the specified database.
ObjectContextManager< C > GetManager(string database, bool isDatabaseName)
Gets the ObjectContextManager object for the specified database.
void Dispose()
Dispose object, dereferencing or disposing the context it is managing.
C ObjectContext
Gets the EF object context object.
ObjectContextManager< C > GetManager(string database)
Gets the ObjectContextManager object for the specified database.
int RefCount
Gets the current reference count for this object.
ObjectContextManager< C > GetManager(string database, bool isDatabaseName, string label)
Gets the ObjectContextManager object for the specified database.
A strongly-typed resource class, for looking up localized strings, etc.
static string DatabaseNameNotFound
Looks up a localized string similar to Database name not found in config file ({0}).