This is a migrated thread and some comments may be shown as answers.

How to find the underlying column in the Domain Model

4 Answers 73 Views
Design Time (Visual Designer & Tools)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 05 Jul 2010, 08:45 PM
I have a table which has two columns (FKs)  each links over to another table (same one)

So it's an approval step table, and it can have a default person, and an assigned person....so I need to link to the people table twice.

The domain model however doesn't tell me the underlying column name...I just get Person and Person 1...the ID columns in the entity don't tell me either...

Can that be added somewhere please?
(does that make sense? :)


4 Answers, 1 is accepted

Sort by
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 05 Jul 2010, 09:02 PM
1 more...Is there an article that talks about the Entity context idea versus the old Scope method?  Do I not have to worry about disposing things anymore (crosses fingers)
0
Petko_I
Telerik team
answered on 08 Jul 2010, 08:03 PM
Hello Steve,

Actually there isn’t such a comparison available in one place. The features are scattered all over the documentation. Here I will provide a brief comparison of the two contexts.  

Both IObjectScope and Entity Diagrams context offer access to the collection of mapped entity objects. You can use LINQ to query your data easily using both. By using both contexts you can also add, update, delete and refresh objects and save or discard changes; monitor changes; execute stored procedures; retrieve objects by the unique key identifying them. With the IObjectScope you can access the transaction properties but you need to manage the life cycle of the transaction execution (making sure a transaction is started whether it is set automatically or not). With the new Entity Diagrams context you can call SaveChanges and let the transaction management be transparent to your business logic. The IObjectScope also provides the ability to track changes by implementing custom logic for the tracking events. Besides, you can use OQL and execute SQL statements. However, the same functionality and even more flexibility can be achieved with LINQ. If you need to expose the functionality of the IOBjectScope with the new context you can define a class which extends the Entity Diagrams context class and use the protected method which returns an IObjectScope.

As to your first question, by the sound of it, you are forward mapping a model and trying to understand the underlying column names. Currently with the forward mapping wizard you can see the generated DB column name. In case you use the reverse mapping visual designer, the mapping details editor also hints at the DB column and property match.  In the forward mapping scenario you need to be careful with the naming conventions we use by default. If you do not specify a field for a property you want to have in your entity, the name recorded in the database will be one that may not always be very meaningful to you. To avoid the confusion you can specify fields which are wrapped by the properties. Thus the naming rules can benefit from the name of the field.  

Do not hesitate to contact us for further questions.


Kind regards,
Petko_I
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 08 Jul 2010, 08:21 PM
Actually no, it's reverse mapped with the designer model (I thought forward wasn't possible yet?)

So it knows that I have fk references to another table and it shows the line connecting those tables...but I can't rename the properties in the entity properly if I don't know which references which column...

So lets say I have two sql columns defined as defaultApproverID and administratorID, those map to the people table...
The entity designer however just shows me Person1, Person2 (or Person, Person1)...I have no way of knowing which maps to which in order to rename the property.

So I think I confused you with the terminology (sorry)...it's the collection\object property the entity generates for the reference that I need to know how it maps back.
0
Petko_I
Telerik team
answered on 13 Jul 2010, 08:51 PM
Hi Steve,

Probably I did not express myself clearly about the forward mapping. Forward mapping is supported with the Classic Wizard but you cannot mix the Visual Designer approach with the old wizard one.

You mention “entity designer” and what you probably mean is the Classic Reverse Mapping wizard as the new one provides meaningful names to reference properties. Anyway, here I will give you guidelines on how to understand the corresponding column names.

The first case is that you are using the Classic Reverse Mapping wizard. When you click on a reference in the Advanced View, to the right of the table you are mapping you can see a "Field to Column Mapping" group box which shows the underlying column name.

The second case is that you are using the new Visual Designer. The generated property names are set by default in way that corresponds to the relational model column names. If you would like to understand the column names for the properties in the designer, you can select an entity on the designer and check the Mapping Details Editor where all of the property-to-column mappings are presented.

I hope this will solves your issue. Do not hesitate to contact us again for anything else that troubles you.


Kind regards,
Petko_I
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Design Time (Visual Designer & Tools)
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Petko_I
Telerik team
Share this question
or