All Projects → roydukkey → NHibernate-X-Factories

roydukkey / NHibernate-X-Factories

Licence: MIT License
NHibernate X-Factories allows you to merge all those .cfg.xml files into one.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to NHibernate-X-Factories

coreddd
A set of open-source .NET libraries helping with domain-driven design (DDD) and CQRS
Stars: ✭ 68 (+423.08%)
Mutual labels:  nhibernate
MultiTenancyFramework
Everything you need to jump-start building multi-tenant applications in C# using any framework of your choice.
Stars: ✭ 29 (+123.08%)
Mutual labels:  nhibernate
CodexMicroORM
An alternative to ORM's such as Entity Framework, offers light-weight database mapping to your existing CLR objects. Visit "Design Goals" on GitHub to see more rationale and guidance.
Stars: ✭ 32 (+146.15%)
Mutual labels:  nhibernate
dotnet-security-unit-tests
A web application that contains several unit tests for the purpose of .NET security
Stars: ✭ 25 (+92.31%)
Mutual labels:  nhibernate
ExtApp
ExtApp是一个基于三层架构,使用NHibernate、API Controller和ExtJs创建的,用于简化政府和企业应用开发的Web应用程序框架。
Stars: ✭ 14 (+7.69%)
Mutual labels:  nhibernate
NHibernate.Spatial
NHibernate.Spatial is a library of spatial extensions for NHibernate, and allows you to connect NHibernate to a spatially enabled database and manipulate geometries in Linq or HQL using NetTopologySuite, providing you with a fully integrated GIS programming experience.
Stars: ✭ 38 (+192.31%)
Mutual labels:  nhibernate
nmg
NHibernate Mapping generator from existing database tables
Stars: ✭ 114 (+776.92%)
Mutual labels:  nhibernate
Templates
CodeSmith Generator Templates
Stars: ✭ 52 (+300%)
Mutual labels:  nhibernate
NHibernate.AspNetCore.Identity
ASP.NET Core Identity Provider for NHibernate
Stars: ✭ 54 (+315.38%)
Mutual labels:  nhibernate
Nhibernate Core
NHibernate Object Relational Mapper
Stars: ✭ 1,918 (+14653.85%)
Mutual labels:  nhibernate
Fluent Nhibernate
Fluent NHibernate!
Stars: ✭ 1,611 (+12292.31%)
Mutual labels:  nhibernate

NHibernate X-Factories v5.1.0

NHibernate X-Factories allow you to combine multiple .cfg.xml into one. X-Factories does this by allowing each session-factory to be named and referred to individually by name. This gives a cleaner and less verbose configuration for using NHiberate between multiple databases.

Setup

Setup is really quite simple.

  1. Install via NuGet.
  2. The nhibernate-configuration-x-factories.xsd scheme may be included to a Project or Solution and is available in the NuGet package root folder.
  3. Change the xmlns attribute of the hibernate-configuration element in your .cfg.xml to urn:nhibernate-configuration-2.2-x-factories.
  4. Change hibernate-configuration element to hibernate-configuration-x-factories.
  5. Give the session-factory element a name and create as many session-factory elements as you like.

Usage

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration-x-factories xmlns="urn:nhibernate-configuration-2.2-x-factories">
	
	<session-factory name="Development">
		<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
		<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
		<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
		<property name="connection.connection_string">
			Server=dsql01;DataBase=dbDev;uid=nhDeveloper;pwd=pass1234
		</property>

		<property name="show_sql">true</property>

		<mapping assembly="DataLayer" />
	</session-factory>
	
	<session-factory name="Production">
		<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
		<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
		<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
		<property name="connection.connection_string">
			Server=psql02;DataBase=dbDev;uid=nhDeveloper;pwd=pass5678
		</property>
		
		<property name="show_sql">false</property>

		<mapping assembly="DataLayer" />
	</session-factory>
	
</hibernate-configuration-x-factories>
using NHibernate;
using NHibernate.Cfg;
using NHibernate.XFactories;

NHibernate.Cfg.Configuration config = new NHibernate.Cfg.Configuration();
config
	.Configure(HostingEnvironment.MapPath("~/nhibernate.cfg.xml"), "Development")
	.BuildSessionFactory();

Support

Required

Optional

License

Licensed under the MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].