Defining a derive entity class

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
sbilbrey
Posts: 1
Joined: Mon 07 Feb 2011 13:28

Defining a derive entity class

Post by sbilbrey » Mon 07 Feb 2011 14:10

I have the following structure in my db:

Order:
- OrderId

OrderPerson:
- OrderId
- PersonTypeId

PersonType:
- PersonTypeId
- Description ("Customer", "Requester", "Salesman",...)

I understand that I can add a new class/entity that inherits from OrderPerson and call that class/entity OrderCustomer, OrderRequester, OrderSalesman...

What I am struggling with is where/how to define the additional criteria:
PersonType.Description == "Customer"

I know I can do it at the query level, but I want to deifne it at the model level. I also want to eastablish the rule that an order is not recognized as an order until it has a Customer, Requester, and Salesman.

My environment is Oracle 11g, VS2010, EF4, Devart dotConnect for Oracle Professional and Devart OraDeveloper Tools.

Thanks,
Sammer

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 09 Feb 2011 16:35

Try creating a Defining Query joining the OrderPerson and the PersonType entities. This new entity can be divided to three types using the Table Per Hierarchy Inheritance.
Please note that you will probably need to create a set of stored procedures for insert/update/delete operations for all these new entities.

Post Reply