none
Code First and Dynamic Classes RRS feed

  • Question

  • I have a need to use EF but I do not know the database structure so I can't create the classes at design time, this has to be done at runtime. Does EF support this somehow?

     

    thx

    Ralph

    Wednesday, July 13, 2011 11:21 AM

Answers

  • Hi,

    How you plan to use Code-First and EF without knowing the schema layout you want to work against at designtime? Using EF and LINQ you need to know the classes to execute queries.

    There is however possible to create/modify a EF model (edmx) runtime and use ESQL to query this and use DbDataReader to read out the result. But I think that it would be easier doing what you want with classic ADO.NET instead if you don't know the model at designtime.

     


    --Rune
    Wednesday, July 13, 2011 12:07 PM

All replies

  • Hi,

    How you plan to use Code-First and EF without knowing the schema layout you want to work against at designtime? Using EF and LINQ you need to know the classes to execute queries.

    There is however possible to create/modify a EF model (edmx) runtime and use ESQL to query this and use DbDataReader to read out the result. But I think that it would be easier doing what you want with classic ADO.NET instead if you don't know the model at designtime.

     


    --Rune
    Wednesday, July 13, 2011 12:07 PM
  • Hi Ralph,

     

    Welcome to the forum.

    What do you mean CodeFirst, No Database Structure, At Design Time?

    During the designing I think we do not care about the recoginze and the code develop.

    During the developing we should need to know the detail design.

    Could you show more  me informations?

     


    If it's helpful for you, Please vote or mark. Thank you!

    David Peng [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.


    Friday, July 15, 2011 3:17 AM
    Moderator