Class DbContextFactory

Class that creates dbContext instances and scopes them either to a thread or a Web context for efficient reuse.

System.Object
  Westwind.Data.EfCodeFirst.DbContextFactory
public class DbContextFactory : object

Class Members

MemberDescription

Constructor

GetDbContext

Creates a new DbContext for a specific DbContext type

public static TDbContext GetDbContext()

public static TDbContext GetDbContext(string connectionStringId)

GetThreadScopedDbContext

Creates a Thread Scoped DataContext object that can be reused. The DataContext is stored in Thread local storage.

public static TDbContext GetThreadScopedDbContext(string connectionStringId)

GetWebRequestOrThreadScopedDataContext

Retrieves a Web Request DbContext if available. If not available will use a thread scoped DbContext instead

public static TDbContext GetWebRequestOrThreadScopedDataContext(string connectionStringId)

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(string connectionStringId)

Requirements

Namespace: Westwind.Data.EfCodeFirst
Assembly: westwind.data.dll

© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic