Hi James thank you very much for your time.
I might be ok with Table per class hierarchy. Let' stick to with that even
if we now CodingAction can relaten to other CodingAction, not just to
TestingAction. The real problemis still there in Triple.
public Triple()
{
References(x => x.Project);
References(x => x.Coding);
References(x => x.Testing);
}
Still I would not be able to express that
x.Project +x.Coding must match an entry in Action table
x.Project +x.Testing must match an entry in Action table
That i s my requirement to express that the relation between two Actions is
bounded to a single common Project.
By the way in MSSQL we could do that if we deine a UNIQUE constraint in th
action table:
create table Action (
Id int,
Project_id int,
type varchar(200)
)
alter table Action add constraint uq...@project_id
unique(Id, Project_id)
go
This constraint is really odd actually: Id is the primary key so Id is
unique then (Id, Projectid) is certainly unique.
Yes but the existence of such an explicit unique key is required for the
action table to be referencable by (id,Project_id).
Once that is done I could set up the correct foreign key from Triple.
So the steps for solving
1. define a unique constraint on Action BTW this may be a little bit
different in case of other inheritance mappings (e.g the original one)
2. Abitility to use that Unique Key as the referenced Key in Triple.
I confess I have some troubles in achiving both. At lesat I have troubles
with 1 in my original setup.
Is all this a bit artificial? well just a bit but not too much.
By The way if we define
public class Project:Entity{
IEnumerable<CodingAction> CodingActions {get; set;} /*to keep it short*/
IEnumerable<TestingAction> TestingActions {get; set;}
}
Then the Joined Subclass thing comes out quite naturally.
Instead
public class Project:Entity{
IEnumerable<Action> Actions {get; set;} /*to keep it short*/
}
leads to naturally to your set up.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---