null value indicates that the default value of the underlying provider will be used.
/// A zero value indicates an infinite timeout.
protected Database(TContext context, int? commandTimeout)
{
Context = context;
ProxyCreationEnabled = false;
if(commandTimeout.HasValue)
{
// Get the ObjectContext related to this DbContext
var objectContext = (context as IObjectContextAdapter).ObjectContext;
objectContext.CommandTimeout = commandTimeout.Value;
}
}
#endregion
#region Context
/// false, this will turn OFF lazy loading on all entities but will allow for json serialization!!
/// Note: When creating instances of POCO entity types, the Entity Framework creates /// instances of a dynamically generated derived type that acts as a proxy for /// the entity which can create complications when serializing proxy instances /// http://blogs.msdn.com/b/adonet/archive/2011/02/02/using-dbcontext-in-ef-feature-ctp5-part-8-working-with-proxies.aspx ///
///true if proxy creation is enabled; false otherwise. Default is false.
/// true to release both managed and unmanaged resources;
/// false to release only unmanaged resources.
///
protected virtual void Dispose(bool disposing)
{
if(!_disposed)
{
if(disposing)
{
Context.Dispose();
}
}
_disposed = true;
}
///