none
How to add derived fields to an entity data model generated from an underlying database RRS feed

  • Question

  • I am using a entity framework model generated from an ERP system in my web application. I do not have control of the ERP database so am looking to use EF to solve a particular issue I have. The ERP databse does not store integer zeros or blank strings as nulls which is what I need to generate a tree view control in the web app.

    Can I append a field to the entity representing the table in the edmx file which is derived from the real database field but which will implement a null value if the field value is zero (for the integers) or blank (for string)?

    I can then reference this field in my web control which is liked to the entity data source.

    Any help greatly appreciated.

    Wednesday, November 2, 2011 8:12 PM

Answers

  • Could you do this with a Complex Type that is essentially all the fields in your entity and the additional field?  You can fill this Complex Type using a stored procedure.  Once you have it filled, you can reference the additional field in your web control just like you do with a field in an entity. 
    Christine A. Piffat
    Thursday, November 3, 2011 2:17 AM