Hi,
I am quite new to fluent NH, so please bare with me if this is a
newbie question.
I am dealing with a legacy db which consist of table with composite
primary key. For example, I have 2 domain object DOMAIN and DOMAIN_TL
and here is the mapping class I have.
public class DomainMap : ClassMap<Domain>
{
public DomainMap()
{
WithTable("DOMAIN_VALUE");
UseCompositeId().WithKeyProperty(x => x.DomainName,
"DOMAIN_NAME").WithKeyProperty(x => x.Value, "VALUE");
Map(x => x.IsDefault).TheColumnNameIs
("DEFAULT_YN").CustomTypeIs(typeof(NHibernate.Type.YesNoType));
HasMany<DomainTL>(x => x.DomainTLs)
.WithKeyColumn("DOMAIN_NAME")
.WithKeyColumn("VALUE")
.Inverse()
.LazyLoad();
}
}
and
public class DomainTLMap : ClassMap<DomainTL>
{
public DomainTLMap()
{
WithTable("DOMAIN_VALUE_TL");
UseCompositeId().WithKeyProperty(x => x.DomainName,
"DOMAIN_NAME")
.WithKeyProperty(x => x.Value, "VALUE")
.WithKeyProperty(x => x.Lang, "LANG");
Map(x => x.CreateDate).TheColumnNameIs("CREATE_DATE");
Map(x => x.CreateUser).TheColumnNameIs("CREATE_USER");
Map(x => x.DisplayOrder).TheColumnNameIs("DISPLAY_ORDER");
Map(x => x.DomainDisplayName).TheColumnNameIs
("DISPLAY_VALUE_TL");
Map(x => x.ModifyDate).TheColumnNameIs("MODIFY_DATE");
Map(x => x.ModifyUser).TheColumnNameIs("MODIFY_USER");
Map(x => x.SearchString).TheColumnNameIs("SEARCH_STRING");
References(x => x.Domain).WithColumns("DOMAIN_NAME",
"VALUE").LazyLoad();
}
}
This works fine, but I was wondering if I can let Fluent NH do the
mapping for me instead. Also, I have a lot of varchar(1) field which
is always have names end with "_YN" which should be map to a bool
type. Can this be done with Automapping also?
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---