Look at the BeforeMapClass event in this post;

http://fabiomaulo.blogspot.com/2011/04/nhibernate-32-mapping-by-code.html

You should do this with the mapper before building the mappings.

2011/7/13, Richard Wilde <[email protected]>:
> Hi,
>
>
>
> I am playing with mapping by code and am wondering about conventions.
>
>
>
> All of my mapping files share the same common functionality:-
>
>
>
> 1.       All table names are lowercase:-
>
> Table("organisationincometype");
>
>
>
> 2.       All Bags have:-
>
> bag.Cascade(Cascade.All | Cascade.DeleteOrphans)
>
> and
>
> bag.BatchSize(10)
>
> and
>
>                                 action => action.OneToMany()
>
>
>
> So my question is, is this possible to do via conventions? If so how as I
> have seen a couple of posts by Fabio but cannot fathom this out.
>
>
>
> My code to configure and build session factory is:-
>
>
>
>
>
> var mapper = new ModelMapper();
>
> mapper.AddMappings(typeof(Organisation).Assembly.GetTypes());
>
>
>
> var configure = new Configuration();
>
> configure.DataBaseIntegration(x =>
>
>                                   {
>
>                                          x.Dialect<MySQL5Dialect>();
>
>                                          x.ConnectionStringName = "db";
>
>
> }).CurrentSessionContext<WebSessionContext>();
>
>
>
> var mapping = mapper.CompileMappingForAllExplicitlyAddedEntities();
>
> configure.AddDeserializedMapping(mapping, "Domain");
>
>
>
> SessionFactory = configure.BuildSessionFactory();
>
>
>
>
>
> Thanks
>
> Rippo
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
Enviado desde mi dispositivo móvil

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to