Thanks Fabio, just changed to convention mapping and got rid of my mapping classes. This is great!
On Apr 14, 1:26 pm, Fabio Maulo <[email protected]> wrote: > Luka, > you can use your conformist-mapping, as is without touch a single line, even > with ConventionModelMapper without problems (it will come with the new > version). > All declarative-mapping is an override of the convention so the > "transformation" is painless. > > > > > > > > > > On Thu, Apr 14, 2011 at 3:41 AM, Luka <[email protected]> wrote: > > Thanks Fabio, you solved my problem. > > :-D > > > I love this new way of mapping. > > > On Apr 14, 1:49 am, Fabio Maulo <[email protected]> wrote: > > > Your domain is now a post about mapping by conventionshttp:// > > fabiomaulo.blogspot.com/2011/04/nhibernate-32-mapping-by-code_... > > > > On Wed, Apr 13, 2011 at 1:33 PM, Fabio Maulo <[email protected]> > > wrote: > > > > Luka. > > > > If you want a specific cascade for ManyToOne relation by default you > > can do > > > > it without specify it explicitly everywhere: > > > > var mapper = new ModelMapper(); > > > > > mapper.BeforeMapManyToOne += (mi, pp, map)=> map.Cascade(Cascade.All); > > > > mapper.AddMappings(typeof(User).Assembly.GetExportedTypes().Where(t => > > > > !t.IsGenericTypeDefinition)); > > > > > Then what you will specify in your mapping classes will naturally > > override > > > > it... but at this point you have to do it only where really needed ;) > > > > > On Wed, Apr 13, 2011 at 11:38 AM, Luka <[email protected]> wrote: > > > > >> Ok, thanks Fabio. > > > >> Mail with the SimpleDomain is sent to you. > > > > >> On Apr 13, 4:35 pm, Fabio Maulo <[email protected]> wrote: > > > >> > That is not the way to do it in NH. > > > >> > I'll publish the example when you send me the little domain > > > > >> > On Wed, Apr 13, 2011 at 11:26 AM, Luka <[email protected]> wrote: > > > >> > > I have classes with same properties, like: > > > >> > > Id, > > > >> > > CreatedDate > > > >> > > Version > > > > >> > > So instead to define these properties in each mapping class, I > > have > > > >> > > created a base mapping class. > > > >> > > So I created and Entity that has these properties, and class > > EntityMap > > > >> > > where I map these properties. EntityMap inherits from > > ClassMapping. > > > >> > > Every Entity in my Domain inherits from entity class that is > > abstract, > > > >> > > and every mapping file in my domain inherits from EntityMap class. > > > >> > > I am sending you a simple domain like you requested. > > > > >> > > thanks > > > > >> > > On Apr 13, 3:46 pm, Fabio Maulo <[email protected]> wrote: > > > >> > > > I think you are trying to use NH as FNH but it is not the same. > > > >> > > > Try to explain you you want have, send me the little domain, and > > I > > > >> will > > > >> > > > publish a usage-example. > > > > >> > > > On Wed, Apr 13, 2011 at 9:40 AM, Luka <[email protected]> > > wrote: > > > >> > > > > Hi > > > >> > > > > I get this exception when trying to use new mapping by code: > > > >> > > > > System.ArgumentException: Cannot create an instance of > > > >> > > > > Domain.Model.EntityMap`1[T] because > > Type.ContainsGenericParameters > > > >> is > > > >> > > > > true. > > > > >> > > > > My class mapp is like this: > > > > >> > > > > public class Entity: IEntity<Guid> > > > >> > > > > { > > > >> > > > > public virtual Guid Id {get;set;} > > > >> > > > > } > > > > >> > > > > public class EntityMap<T>: ClassMapping<> where T:Entity > > > >> > > > > { > > > >> > > > > Id(x=>x.Id, map=>map.Generator(Generators.GuidComb)); > > > >> > > > > } > > > > >> > > > > public class PersonMap: EntityMap<Person> > > > >> > > > > { > > > >> > > > > .... > > > >> > > > > } > > > > >> > > > > Please help > > > > >> > > > > -- > > > >> > > > > 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. > > > > >> > > > -- > > > >> > > > Fabio Maulo > > > > >> > > -- > > > >> > > 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. > > > > >> > -- > > > >> > Fabio Maulo > > > > >> -- > > > >> 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. > > > > > -- > > > > Fabio Maulo > > > > -- > > > Fabio Maulo > > > -- > > 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. > > -- > Fabio Maulo -- 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.
