Hello:

I was expecting the HasOne relationship that is part of my inheritance
mapping to not let me save a ProjectActivity unless it's Project
attribute exists in the db (Project is a mapped Entity also). Is there
an option I can use to enforce this?

Thanks!
B

Domain inheritance hierarchy
-------------------------------------------------
public abstract class Activity : Entity    {      ...  }

public class ProjectActivity : Activity    {
        public virtual Project Project { get; private set; }
 }

public class AccountActivity : Activity    {
        public virtual Account Account{ get; private set; }
 }

Mapping
-----------------------
public class ActivityMap : IAutoMappingOverride<Activity>
    {
        public void Override(AutoMap<Activity> mapping)
        {
           ..........

            mapping.DiscriminateSubClassesOnColumn("ActivityType")
                .SubClass<ProjectActivity>("P",
                    x => x.HasOne(y => y.Project)
                        .Cascade.None()
                        .FetchType.Join())

                .SubClass<AccountActivity>("A",
                    x => x.HasOne(y => y.Account).Cascade.SaveUpdate
().FetchType.Join())
        }
    }
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to