-
Notifications
You must be signed in to change notification settings - Fork 0
OrmAbstractions
The package CSF.ORM provides a small abstraction around a set of commonly-uses features of ORM software, primarily looking at NHibernate and its Linq functionality. It does this via two interfaces which business logic may consume:
IQuery
IPersister
The IQuery
interface provides the following functions:
This function gets an entity object from the data-source using its identity (primary key) value. If the entity does not exist in the data-source then this method will return null.
This function returns a stand-in or proxy object which represents a theory that the entity with the specified identity (primary key) value exists in the underlying data-source. It does not use the data-source to verify whether this theory is correct or not, though.
For further information, read about when to use Theorise and when to use Get.
The Query<T>
method returns an IQueryable<T>
object, upon which further Linq may be used. This provides an API with which to write dynamic queries upon the data-source.
The ORM API also provides a number of Linq extension methods which add additional functionality to IQueryable<T>
objects.
These are the methods exposed by the IPersister
interface. All of the following methods have synchronous and also Async
versions. The async methods have identical functionality but use an async API, which will provide performance improvements when used in a suitable application architecture.
These methods add a new object to the data-store which does not already exist there. The return value is that of the object identity/primary key value.
These methods indicate to the underlying ORM that it should write changes made to the in-memory state of an object to the underlying data-store.
These methods instruct the ORM to remove an existing object from the data-store.