Class that creates dbContext instances and scopes them either to a thread or a Web context for efficient reuse.
Westwind.Data.EfCodeFirst.DbContextFactory
public class DbContextFactory : object
Class Members
Member | Description | |
---|---|---|
Constructor |
||
GetDbContext |
Creates a new DbContext for a specific DbContext type public static TDbContext GetDbContext public static TDbContext GetDbContext |
|
GetThreadScopedDbContext |
Creates a Thread Scoped DataContext object that can be reused. The DataContext is stored in Thread local storage. public static TDbContext GetThreadScopedDbContext |
|
GetWebRequestOrThreadScopedDataContext |
Retrieves a Web Request DbContext if available. If not available will use a thread scoped DbContext instead public static TDbContext GetWebRequestOrThreadScopedDataContext |
|
GetWebRequestScopedDbContext |
Creates a ASP.NET Context scoped instance of a DbContext. This static method creates a single instance and reuses it whenever this method is called. public static TDbContext GetWebRequestScopedDbContext |
Requirements
Namespace: Westwind.Data.EfCodeFirstAssembly: westwind.data.dll
© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic