Defining EF Custom Properties for use with Dynamic Data RRS feed

  • Question

  • User1034852846 posted

    Is it possible to extend the EF Data Model with custom properties for use with Dynamic Data and if so how ?

     Happy New Year All !


    Thursday, January 1, 2009 7:59 AM


All replies

  • User-330204900 posted

    You can add your own custom properties to EF but the EntityDataSource does not supoport them at this time so DD will not see them sorry [:(]

    Thursday, January 1, 2009 8:11 AM
  • User1034852846 posted

    Thanks, Steve...

    That's the answer I wasn't hoping to get !!!

     I need a way to show a calculated field in a DynamicData EF. Apart from a custom FieldTemplate is there any other way to achieve this ?


    Thursday, January 1, 2009 8:27 AM
  • User-330204900 posted

    No I've had to use custom FieldTemplates in EF to do this. But I ususally end up going back to L2S st everything is som much easyer. You would'nt think the same company wrote them would you? I just wish EF lived up to Linq to SQL [:D] maybe in the next release [:O]

    Thursday, January 1, 2009 9:30 AM
  • User1034852846 posted

    Thanks Steve...

    Do you have know of any examples of FieldTemplates that access values of a related entity ? For example if I design a field template for the Order entity I'd like to access properties of the Customer entity from it. (I can currently get Order properties using GetColumn & GetColumnValues)

    Thursday, January 1, 2009 9:52 AM
  • User-330204900 posted

    You would cast the Row property (in OnDatabinding) to the entity for your custome FieldTemplate and then you can access all it's members and associations but remember that you need to implicily load any related tables Like Order.CustomerReference.Load() David Ebbo mentioned in your other thread [:D]

    Thursday, January 1, 2009 10:30 AM
  • User1034852846 posted

    I could'nt do a simple cast of the Row object but after some digging I found an article http://blogs.msdn.com/diego/archive/2008/05/13/entitydatasource-to-wrap-or-not-to-wrap.aspx that allows me to extract the entity.

    Thanks once again, Steve.


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 1, 2009 11:38 AM
  • User-330204900 posted

    Ah yes I do remember David mentioning that in a recent post [:$]

    Thursday, January 1, 2009 12:09 PM