Hi,
I have the follow data structure:
CREATE TABLE Payment (
AccountID varchar(20) NOT NULL,
PaymentID uniqueidentifier NOT NULL,
InsertTimeStamp datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
UpdateTimeStamp datetime NULL,
OperationDate datetime NOT NULL
...
)
ALTER TABLE Payment
ADD PRIMARY KEY NONCLUSTERED (AccountID, PaymentID)
go
CREATE TABLE PaymentCreditCard (
AccountID varchar(20) NOT NULL,
PaymentID uniqueidentifier NOT NULL,
...
)
ALTER TABLE PaymentCreditCard
ADD PRIMARY KEY (AccountID, PaymentID)
go
CREATE TABLE PaymentPayPal (
AccountID varchar(20) NOT NULL,
PaymentID uniqueidentifier NOT NULL,
....
)
ALTER TABLE PaymentPayPal
ADD PRIMARY KEY (AccountID, PaymentID)
go
ALTER TABLE PaymentPayPal
ADD FOREIGN KEY (AccountID, PaymentID)
REFERENCES Payment
go
ALTER TABLE PaymentCreditCard
ADD FOREIGN KEY (AccountID, PaymentID)
REFERENCES Payment
go
So, basically I have a Payment table and its specializations (PaymentCreditCard and PaymentPayPal).
What I want to do is inform a OperationDate and receive a EntityCollection of Payments. This means that if a Payment is a credit card payment, i should receive a PaymentCreditCardEntity type for a given item on the EntityCollection<PaymentEntity>. If a Payment is a pay pal payment, I should receive a PaymentPayPalEntity type for a given item on the EntityCollection<PaymentEntity>. And so on.... so on the same collection i can have all this payments types, since all of them are types of PaymentEntity.
I'm NOT using the discriminator since the LLBLGen create this sub-types automatically when I choose "Construct Target-per-Entity Hierarchies". I do have this information on Payment table (PaymentTypeID), but I'm not able to use it (what I think it would be nice to have this mix of techniques, but this is another discussion)
Thank you,
David