NHibernate
NHibernate is S#arp Architecture’s only supported persistence provider as of 9.0.0 (the
SharpArch.RavenDB library was discontinued in that release). The SharpArch.NHibernate
and SharpArch.NHibernate.DependencyInjection packages provide:
NHibernateSessionFactoryBuilder— a fluent builder forISessionFactory(mapping assemblies, Fluent auto-persistence models,hibernate.cfg.xml, 2nd-level cache, data-annotation validators).AddNHibernateWithSingleDatabase(...)— wires the builder’s output intoIServiceCollectionwith the right lifetimes (see Installation).NHibernateRepository<TEntity,TId>/LinqRepository<TEntity,TId>— implementations of the domain’sIRepository/ILinqRepositoryinterfaces.TransactionManager— the NHibernate implementation ofITransactionManager, used by[Transaction]/AutoTransactionHandler(see Unit of Work).
Topics
For a complete, working example of all of the above, see the
TardisBank sample project.