none
How to populate EF objects dynamically @ RRS feed

  • Question

  • Hello,

          I am working on ASP.NET MVC 3 with EF 4.1 project. In my Project I have a situation where I have to populate my EF POCObjects dynamically at runtime. Means In my Class1 if there are prop1 to prop 15 are presnet at runtime I need only prop1,prop4,prop10 & prop12  instrad of all 15 peoperties which are currently populated. Problem is my selection of these properties is not defined at design time it has to be worked out at runtime.

          Can anyone tell me what should I do?

     

    Nilkanth Desai

     

    Saturday, June 25, 2011 9:55 AM

Answers

  • Hi Nilkanth;

    If you need to build the query at run time then using Entity SQL is what you need to use. Entity SQL is a SQL like string statements which Entity Freamwork then converts to T-SQL before sending it to the server. See this link, Entity SQL Language : http://msdn.microsoft.com/en-us/library/bb399560.aspx The section Using Entity SQL with object queries.

     


    Fernando

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Saturday, June 25, 2011 3:37 PM

All replies

  • Hi Nilkanth;

    If you need to build the query at run time then using Entity SQL is what you need to use. Entity SQL is a SQL like string statements which Entity Freamwork then converts to T-SQL before sending it to the server. See this link, Entity SQL Language : http://msdn.microsoft.com/en-us/library/bb399560.aspx The section Using Entity SQL with object queries.

     


    Fernando

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Saturday, June 25, 2011 3:37 PM
  • Any update? Would you mind letting us know how it goes?

    Best Regards,


    Larcolais Gong[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, June 27, 2011 7:21 AM
  • Hello,

           Thanks for u r reply. I am reviewing u r suggestion. Did not arrive at any conclusion. I will update this post when I will conclude it.

     

    Thanks,

     

    Nilkanth Desai

     

    Wednesday, June 29, 2011 2:11 AM
  • Any update? Would you mind letting us know how it goes?

    Please feel free to let us know if you need further support.

    Best Regards,


    Larcolais Gong[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 8, 2011 4:56 PM