Click here to Skip to main content
15,443,631 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello, Fluent Nhibernate Experts Please help me,
I am using Fluent Nhibernate in my Project.

I got sucess in implementing Fluent Mappings.

I want to try with Automappings in fluent nhibernate.

please help me with any Tutirial or sample project.


Thanks in Advance..
Posted

1 solution

Hi,

This is some sample from Fluent GitHub:

https://github.com/jagregory/fluent-nhibernate/wiki/Auto-mapping

This is a sample for our configuration file

C#
private static ISessionFactory CreateSessionFactory()
{
     return Fluently.Configure().Database(
	MsSqlConfiguration.MsSql2008.ConnectionString(System.Configuration.ConfigurationManager.ConnectionStrings[
             "WebService.Properties.Settings.connectionString"].ConnectionString)).Mappings(
		m => m.AutoMappings.Add(AutoMap.AssemblyOf<ientity>().IgnoreBase<BaseEntity>()
			.Where(t => t.Namespace == "Domain.Entities")
			.UseOverridesFromAssemblyOf<domainentityoverride>))
			.ExposeConfiguration(UpdateSchema)
			.BuildSessionFactory();        
}


This code uses automapping, Configuration connection string, overrides and Automapping Inheritance, You can check in the link above.

Ilan
 
Share this answer
 
v2
Comments
Member 10004269 14-Oct-13 3:09am    
Thanks Ilan Geller

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900