-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This repository contains projects and NuGet packages relating to the usage of Object-relational mapping (ORM) systems in .NET (framework and dotnet core). They are primarily aimed at users of NHibernate.
The intent behind these packages is to provide an API which may be consumed directly from domain/business logic code for the majority of day-to-day usage of the ORM. This comes with a few benefits:
- Domain logic does not require a direct dependency upon NHibernate
- No need to write boilerplate repository-style logic to encapsulate the majority of data access
- In unit testing/prototyping the ORM may be swapped-out for an in-memory collection of objects
Use the Entity<T>
base class for your domain entities for a concise and consistent way to express entity identity and compare for equality.
Your domain logic/business logic projects should not depend upon the ORM/NHibernate directly. Instead depend upon CSF.ORM and optionally CSF.ORM.Entities. Perform the majority of your data-access using the API provided by the interfaces IQuery
& IPersister
and, if using the Entities library, the IEntityData
interface.
Your application should also make use of dependency injection, through either the dotnet core built-in dependency injection or one of the many frameworks available. In production, the APIs listed above should be configured to be provided using 'real' implementations of the ORM/NHibernate stack.
For the purpose of unit testing or perhaps rapid prototyping, there is a naïve in-memory implementation of the API available. You can find this in the CSF.ORM project in the InMemory namespace.