I have a mapping question related to Table Per Type. I have following 
hierarchy:

-   Person (maps to table person)
-   A person can be a Subscriber (maps to table Subscriber)
-   A person can be a Service Provider (maps to table ServiceProvider)
-   A person can be {other things}
 


This maps to respective domain objects. The current mapping looks something 
like below:
public class PersonMapping : ClassMap<Models.Person>
{
        public PersonMapping()
        {
            Table("Person");
            Id(p => p.Id);
    ... other props
}
}

public class SubscriberMapping : SubclassMap<Models.Subscriber>
{
  public SubscriberMapping()
        {
            Table("Subscriber");
            KeyColumn("Id")
            ... other props
        }

}

public class ProviderMapping : SubclassMap<Models.Provider>
{
        public ProviderMapping()
        {
            Table("ServiceProvider");
            KeyColumn("Id");
    ... other props
}
}


The problem I am facing is when a person exists but not as a Subscriber. 

The behavior that we are trying to implement is:

Add Subscriber:
 - Check if Person exists by <well defined criteria>
 - If Person was found insert into subscriber table 
 - If Person was not found 
      - Create Person
      - Insert into subscriber table

Can this behavior be achieved using mapping?

Thanks,
PG
 
        

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/fluent-nhibernate/-/g44J_32Yu5cJ.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to