Hi,
I am trying to map this class structure:

public abstract class Entity
{

public virtual Guid Id {get;set;}

public virtual int Version {get;set;}

}

public class Parent: Entity
{

public virtual string ParentName {get;set;}

... 

}

public class Child : Parent
{

public virtual string DisplayName {get;set;}

... 

} 

I am doing Mapping by convention mixed with Mapping by code like this:

public class ChildMappingOverride: UnionSubclassMapping<Child>
{

}

public class NHibernateMapping
{

public void MapDomain()
{

ConventionModelMapper mapper = new ConventionModelMapper();
Type baseEntityType = typeof(Entity);
mapper.IsEntity((t, declared) => (baseEntityType.IsAssignableFrom(t) && 
baseEntityType != t) && !t.IsInterface);
mapper.IsRootEntity((t, declared) => baseEntityType.Equals(t.BaseType));


mapper.Class<Entity>(map =>

            {
                map.Id(x => x.Id, m => m.Generator(Generators.GuidComb));
                map.Version(x => x.Version, m => 
                {
                    m.Column("Version");
                    m.Generated(VersionGeneration.Never);
                    m.UnsavedValue(0);
                    m.Insert(true);
                    m.Type(new Int32Type());
                    m.Access(Accessor.Property);
                });
            }); 

mapper.AddMapping<ChildMappingOverride>();

}

} 

Ok, not whan nhibernate creates database schema I get 2 tables instead of 
only one:
Nhibernate created Tables: Parent and Child.
I want it to create only the table Child that has all the fields: Id, 
Version, ParentName, DisplayName.

How can I do this?
Please help
 




-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to