locked
Entity Framework Dynamic Type Support RRS feed

  • Question

  • I am looking to port an appliction to EF where the primary transaction table is field-configurable to allow the addition of new columns to support a given customer's requirements.  The current application uses metadata to combine the base column set plus the customer-specific ones to form a combined view of the object.  Is there any mechanism to allow modifying the model metadata at runtime to reflect the changes for a given installation?  Or is there another mechanism that might support what I need that I'm not thinking of?

    In 2008 this was apparently part of the thoughts for the future (see here), but I wonder if this sort of capability has been added to EF 4.0/4.1

    Thanks for the guidance.

    Tuesday, September 27, 2011 6:25 PM

Answers

  • DMSchneider,

    I can't think of a easy way to do this dynamically at runtime.  Using a Code first approach might work but even then I don't think you can create something easily that is database agnostic and can adapt at runtime to a different table structure.

    Now I did find a tool, which I haven't tried yet, that claims to be an adapter that can allow you to do runtime modifications of your ObjectContext to adapt to things like table differences in different deployment environments.   It's worth a look if it really works:

    http://efmodeladapter.codeplex.com/


    Tom Overton
    • Marked as answer by Alan_chen Friday, October 7, 2011 7:01 AM
    Wednesday, September 28, 2011 1:22 AM

All replies

  • DMSchneider,

    I can't think of a easy way to do this dynamically at runtime.  Using a Code first approach might work but even then I don't think you can create something easily that is database agnostic and can adapt at runtime to a different table structure.

    Now I did find a tool, which I haven't tried yet, that claims to be an adapter that can allow you to do runtime modifications of your ObjectContext to adapt to things like table differences in different deployment environments.   It's worth a look if it really works:

    http://efmodeladapter.codeplex.com/


    Tom Overton
    • Marked as answer by Alan_chen Friday, October 7, 2011 7:01 AM
    Wednesday, September 28, 2011 1:22 AM
  • Hi,

    I am writing to check the status of the issue on your side. Would you mind letting us know the result of the suggestions?

    If you need further assistance, please feel free to let me know. I will be more than happy to be of assistance.

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, October 3, 2011 7:36 AM