How to find the underlying column in the Domain Model

5 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 05 Jul 2010 Link to this post

    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? :)


  2. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 05 Jul 2010 Link to this post

    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)
  3. DevCraft banner
  4. Petko_I
    Admin
    Petko_I avatar
    184 posts

    Posted 08 Jul 2010 Link to this post

    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
  5. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 08 Jul 2010 Link to this post

    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.
  6. Petko_I
    Admin
    Petko_I avatar
    184 posts

    Posted 13 Jul 2010 Link to this post

    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
Back to Top
DevCraft banner