The article you mentioned is actually refers to the "classic" wizards of OpenAccess. As we do not have such article about the visual designer, I will give you some directions how to achieve that.
Consider the following scenario:
We will use the Person and Employee tables described in the post you saw. The only change we need to do is to modify Employee's primary key column name from "EmployeeID" to "PersonID". The primary key columns of the two tables need to be with the same name.
A new domain model should be generated from the database. This can be done by right-clicking on the project, selecting OpenAccess>Add domain model and following the wizard steps.
After the domain model is generated, some modifications have to be done.
First of all, remove the relations between the classes
(right-click on the connection and click Delete).
Then remove the PersonID property from the Employee class
, as it will inherit the identity of the Person base class.
5. Add inheritance relationship between the two classes so that Employee inherits from Person
. This can be done by clicking on the Toolbox button (this will open the toolbox), selecting the "Inheritance" connection and dragging it from Employee to Person.
As the two classes are mapped to separate tables, Vertical inheritance will have to be used
To set it, select the Employee class and at the bottom of Visual Studio select the Mapping Details Editor tab. Then set the Inheritance strategy to Vertical.
7. Open the Discriminator combo box located in the Mapping Details Editor and select <NONE>
, you should do this even if it's already selected. This is a small visual bug we are working on.
Finally, check if the classes are mapped to the tables
. The Employee mapping will probably be gone, so it has to be added again.
Now everything should be ready. You can test it by using few simple lines of code, for example :
EntitiesModel model =
Employee emp =
// assign values to members
The appropriate record should be added to the database.
(Note that for Vertical mapping, the Discriminator column is not mandatory
, more information on the different kinds of mapping can be found here.
If you want to use a discriminator column, you have two options :
Create it manually in the initial table and then select it from the Mapping Details Editor.
Create the discriminator column manually in the Model Schema Explorer (Tables>Person>Add new column)
and then in the Mapping Details Editor select it to be a Discriminator. Check if the mapping is correct. Right-click on the rlinq designer and click Update database from model. The discriminator column will be generated in the Person table, along with any other modifications.
I hope this helps. If you need further assistance, do not hesitate to ask.
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!