KlusterKite  0.0.0
A framework to create scalable and redundant services based on awesome Akka.Net project.
KlusterKite.Data.EF.BaseContextFactory Class Referenceabstract

Base factory to create entity framework contexts More...

Inheritance diagram for KlusterKite.Data.EF.BaseContextFactory:
KlusterKite.Data.EF.IContextFactory KlusterKite.Data.EF.InMemory.InMemoryContextFactory KlusterKite.Data.EF.Npgsql.PostgresContextFactory

Public Member Functions

TContext CreateContext< TContext > (string connectionString, string databaseName=null)
 Creates context attached to data source. Data source will be used as is. More...
 

Static Public Member Functions

static TContext CreateContext< TContext > (DbContextOptions< TContext > options)
 Creates a new instance of context class More...
 

Protected Member Functions

abstract DbContextOptions< TContext > GetContextOptions< TContext > (string connectionString, string databaseName)
 Creates a context options for a given data More...
 

Properties

abstract string ProviderName [get]
 Gets a unique provider name More...
 
- Properties inherited from KlusterKite.Data.EF.IContextFactory
string ProviderName [get]
 Gets a unique provider name More...
 

Detailed Description

Base factory to create entity framework contexts

Expected that TContext has a public constructor with DbContextOptions<TContext> argument

Definition at line 27 of file BaseContextFactory.cs.

Member Function Documentation

◆ CreateContext< TContext >() [1/2]

static TContext KlusterKite.Data.EF.BaseContextFactory.CreateContext< TContext > ( DbContextOptions< TContext >  options)
static

Creates a new instance of context class

Template Parameters
TContextThe type of context
Parameters
optionsThe context options.
Returns
The new context
Exceptions
InvalidOperationExceptionThe context class must have a public constructor that accepts DbContextOptions<TContext> as single parameter
Type Constraints
TContext :DbContext 

Definition at line 48 of file BaseContextFactory.cs.

◆ CreateContext< TContext >() [2/2]

TContext KlusterKite.Data.EF.BaseContextFactory.CreateContext< TContext > ( string  connectionString,
string  databaseName = null 
)

Creates context attached to data source. Data source will be used as is.

Implements KlusterKite.Data.EF.IContextFactory.

Type Constraints
TContext :DbContext 

Definition at line 55 of file BaseContextFactory.cs.

◆ GetContextOptions< TContext >()

abstract DbContextOptions<TContext> KlusterKite.Data.EF.BaseContextFactory.GetContextOptions< TContext > ( string  connectionString,
string  databaseName 
)
protectedpure virtual

Creates a context options for a given data

Template Parameters
TContextThe type of context
Parameters
connectionStringThe connection string
databaseNameThe database name
Returns
The context

Implemented in KlusterKite.Data.EF.Npgsql.PostgresContextFactory, and KlusterKite.Data.EF.InMemory.InMemoryContextFactory.

Type Constraints
TContext :DbContext 

Property Documentation

◆ ProviderName

abstract string KlusterKite.Data.EF.BaseContextFactory.ProviderName
get

Gets a unique provider name

Definition at line 32 of file BaseContextFactory.cs.


The documentation for this class was generated from the following file: