Class UnitOfWork
Class that represents a unit of work for the Fibula project. All operations that persist data to whatever the underlying storage is, should be done within the same unit of work and persisted at the end of it by invoking Complete().
Inheritance
System.Object
UnitOfWork
Implements
IUnitOfWork<AccountRepository, CharacterRepository, MonsterTypeReadOnlyRepository, ItemTypeReadOnlyRepository>
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Fibula.Common
Assembly: Fibula.Common.dll
Syntax
public class UnitOfWork : IUnitOfWork<AccountRepository, CharacterRepository, MonsterTypeReadOnlyRepository, ItemTypeReadOnlyRepository>, IDisposable
Constructors
| Improve this Doc View SourceUnitOfWork(IApplicationContext, IItemTypeLoader, IMonsterTypeLoader)
Initializes a new instance of the UnitOfWork class.
Declaration
public UnitOfWork(IApplicationContext applicationContext, IItemTypeLoader itemTypeLoader, IMonsterTypeLoader monsterTypeLoader)
Parameters
Type | Name | Description |
---|---|---|
IApplicationContext | applicationContext | The application context to work in. |
IItemTypeLoader | itemTypeLoader | A reference to the item type loader in use. |
IMonsterTypeLoader | monsterTypeLoader | A reference to the monster type loader in use. |
Properties
| Improve this Doc View SourceAccounts
Gets a reference to the accounts repository.
Declaration
public AccountRepository Accounts { get; }
Property Value
Type | Description |
---|---|
AccountRepository |
Characters
Gets a reference to the characters repository.
Declaration
public CharacterRepository Characters { get; }
Property Value
Type | Description |
---|---|
CharacterRepository |
ItemTypes
Gets a reference to the item types repository.
Declaration
public ItemTypeReadOnlyRepository ItemTypes { get; }
Property Value
Type | Description |
---|---|
ItemTypeReadOnlyRepository |
MonsterTypes
Gets a reference to the monster types repository.
Declaration
public MonsterTypeReadOnlyRepository MonsterTypes { get; }
Property Value
Type | Description |
---|---|
MonsterTypeReadOnlyRepository |
Methods
| Improve this Doc View SourceComplete()
Completes this unit of work.
Declaration
public int Complete()
Returns
Type | Description |
---|---|
System.Int32 | The number of changes saved upon completion of this unit of work. |
Dispose()
Disposes this unit of work and it's resources.
Declaration
public void Dispose()
Implements
System.IDisposable