locked
Manual Mapping got remove when i add New table or view from Databse RRS feed

  • Question

  • Hi there,I am new to EF.i have followed following article written Julia lerman to create custom entity as return type and it works fine but everytime i update model from database it remove manual change.please advise how can i solve this.

    http://thedatafarm.com/blog/data-access/implement-select-stored-procedures-that-return-miscellaneous-data-in-ctp2-of-ef-designer/

    i am using Vs2010 and EF 3.5

    Thanks

    ROnak


    Thanks Ron

    Thursday, August 9, 2012 3:28 PM

Answers

  • Hi RonCe;

    In that same article in the comments section was this.

      

    Julie's link in the image is Entity Framework and Read Stored Procedures - a new perspective

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Thursday, August 9, 2012 6:30 PM
  • Hi Ronak;

    The simplest thing to do is to take your stored procedure and make a View of it so that when you query the view the server will execute the SQL statement used to create the View and return a single row to you. You query the View just like you query a normal SQL table.

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by Allen_MSDN Monday, August 13, 2012 1:40 AM
    Friday, August 10, 2012 7:44 PM

All replies

  • Hi RonCe;

    In that same article in the comments section was this.

      

    Julie's link in the image is Entity Framework and Read Stored Procedures - a new perspective

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Thursday, August 9, 2012 6:30 PM
  • Thanks Fernando it make sense.can i select returntype as none and use execute reader to call SP using EntityClient classes ? i did for scalar return type not sure how it will work with none return type.

    please advise 

    ROnak


    Thanks Ron

    Thursday, August 9, 2012 8:24 PM
  •   

    I do not think that will work seeming setting the return type as NONE will not expect a collection of object to be returned.

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Friday, August 10, 2012 2:21 PM
  • Thanks for your reply can you please advise how can i execute store proc which does not return entity.i have store procs which return single row with different column which is not view or table entity type.

    Thanks

    Ronak


    Thanks Ron

    Friday, August 10, 2012 6:31 PM
  • Hi Ronak;

    The simplest thing to do is to take your stored procedure and make a View of it so that when you query the view the server will execute the SQL statement used to create the View and return a single row to you. You query the View just like you query a normal SQL table.

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by Allen_MSDN Monday, August 13, 2012 1:40 AM
    Friday, August 10, 2012 7:44 PM
  • THanks for your reply but we can not convert this SP into View as we are doing some business logic and return variable in select statement.i think there is no other way.i tired to call sp using Entity Client but its not working as i am getting rd[0] as boolean.

    Thanks 

    ROnak

     

    Thanks Ron

    Monday, August 13, 2012 12:27 PM
  •   

    You will need to use one of the above methods to solve your issue for there are no other workarounds. 

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Monday, August 13, 2012 1:02 PM