Class EntityContextFactory
Handles creation of EntityContexts and DataUpdaters.
Inherited Members
Namespace: LemonEdge.Connections.Database.Context
Assembly: LemonEdge.Database.Connector.dll
Syntax
public class EntityContextFactory : IEntityContextFactory, IHaveAddInListeners
Constructors
EntityContextFactory(IFactoryInjector, IDatabaseInfoManager, IDataAccessorFactory, IDomainContextEventHandler, IModelBuilder)
Declaration
public EntityContextFactory(IFactoryInjector factoryInjector, IDatabaseInfoManager databaseInfoManager, IDataAccessorFactory dataAccessorFactory, IDomainContextEventHandler eventHandler, IModelBuilder modelBuilder)
Parameters
Type | Name | Description |
---|---|---|
IFactoryInjector | factoryInjector | |
IDatabaseInfoManager | databaseInfoManager | |
IDataAccessorFactory | dataAccessorFactory | |
IDomainContextEventHandler | eventHandler | |
IModelBuilder | modelBuilder |
Properties
DatabaseCacheFactory
Declaration
public IDatabaseCacheFactory DatabaseCacheFactory { get; set; }
Property Value
Type | Description |
---|---|
IDatabaseCacheFactory |
Methods
AddAddInListeners()
Adds listeners.
Declaration
public void AddAddInListeners()
CheckForEntityDescriptorUpdates(IDataAccessor)
Runs through entities and checks for updated descriptors. If there are changes, the system rebuilds and compiles.
Declaration
public Task CheckForEntityDescriptorUpdates(IDataAccessor accessor)
Parameters
Type | Name | Description |
---|---|---|
IDataAccessor | accessor | An instance of IDataAccessor |
Returns
Type | Description |
---|---|
Task | A Task to await. |
Create(IDataAccessor)
Creates an EntityContext,
Declaration
public Task<EntityContext> Create(IDataAccessor accessor)
Parameters
Type | Name | Description |
---|---|---|
IDataAccessor | accessor | An instance of IDataAccessor |
Returns
Type | Description |
---|---|
Task<EntityContext> | A new EntityContext |
CreateUpdater(IDataAccessor, UserInfo, int?)
Creates a DataUpdater, and UserInfo, but with a specified timeout.
Declaration
public Task<DataUpdater> CreateUpdater(IDataAccessor accessor, UserInfo user, int? commandTimeoutInSeconds = null)
Parameters
Type | Name | Description |
---|---|---|
IDataAccessor | accessor | An instance of IDataAccessor |
UserInfo | user | An instance of UserInfo |
int? | commandTimeoutInSeconds | An optional timeout. |
Returns
Type | Description |
---|---|
Task<DataUpdater> | A new DataUpdater |
CreateUpdaterWithoutUpgradeCheck(IDataAccessor, UserInfo)
Creates a DataUpdater, and UserInfo. DOES NOT call EnsureDatabasesUpgraded(IDataAccessor, string).
Declaration
public DataUpdater CreateUpdaterWithoutUpgradeCheck(IDataAccessor accessor, UserInfo user)
Parameters
Type | Name | Description |
---|---|---|
IDataAccessor | accessor | An instance of IDataAccessor |
UserInfo | user | An instance of UserInfo |
Returns
Type | Description |
---|---|
DataUpdater | A new DataUpdater |
CreateUpgrader(IDataAccessor)
Creates a DatabaseUpgrader, NOTE: Creates a NEW Accessor - so be wary if you're already upgrading.
Declaration
public DatabaseUpgrader CreateUpgrader(IDataAccessor accessor)
Parameters
Type | Name | Description |
---|---|---|
IDataAccessor | accessor | An instance of IDataAccessor |
Returns
Type | Description |
---|---|
DatabaseUpgrader | A new DatabaseUpgrader |
EnsureDatabasesUpgraded(IDataAccessor, string)
Validates that the DB is upgraded, upgrading if not.
Declaration
public Task EnsureDatabasesUpgraded(IDataAccessor accessor, string source)
Parameters
Type | Name | Description |
---|---|---|
IDataAccessor | accessor | An instance of IDataAccessor |
string | source |
Returns
Type | Description |
---|---|
Task | A Task to await. |
IsUpgraded(IDataAccessor)
Returns true if the Database has already been upgraded.
Declaration
public bool IsUpgraded(IDataAccessor accessor)
Parameters
Type | Name | Description |
---|---|---|
IDataAccessor | accessor | An instance of IDataAccessor |
Returns
Type | Description |
---|---|
bool | True if upgraded, false if not. |
RegisterEntityDescriptorUpdaters()
Adds listeners to the DomainContextEventHandler to register AddIn changes...
Declaration
public void RegisterEntityDescriptorUpdaters()
RemoveAddInListeners()
Removes listeners.
Declaration
public void RemoveAddInListeners()
RunDbUpgrade(IDataAccessor, string)
Runs a Database upgrade. Use in conjunction with IsUpgraded(IDataAccessor).
Declaration
public Task RunDbUpgrade(IDataAccessor accessor, string source)
Parameters
Type | Name | Description |
---|---|---|
IDataAccessor | accessor | An instance of IDataAccessor |
string | source |
Returns
Type | Description |
---|---|
Task | A Task to await. |