I am trying to import stored-procedure using the entity framework 4 in Asp.Net,MVC and C#. But when i try to update the model into entity diagram(*.edmx) it will updated into the Entity-name.Store inside Stored-procedure folder.
Stored-Procedure
CREATE PROCEDURE Sp_Feedback AS BEGIN Select f.User_Id,f.Over_All_Rating,f.Features_Liked,f.Features_Need_Improvement, f.Will_Recommend_Us, f.Customer_Service_Rating,f.Comments from Feedback f END
In My stored-procedure i have select few columns from the table not all columns. So i need to create Add new Entity for model mapping to the table. Once Entity is created and add scalar properties to the entity to specify exact name in the table which i need to reterive through the stored-procedure. At last i had to mapping the new entity property name to the exact table entity.
When you expand the expand the stored-procedure folder there is a imported stored-procedure right click stored-procedure select Add Function Import option and dialog open displays that "Funtion Import Name" and "Stored-Procedure Name" is already deteced from the stored-procedure and there is another option which is "Returns a Collection Of" it contains four option which is
i) None ii) Scalars iii) Comlpex iv) Entities.
In the Returns a Collection Option i had to select the Entities option to select the newly created entities for the mapping the stored-procedure reterived columns.Because i need to get the list of records from the table.
Once, i finished build the project i got the error which is there is no key value for the newly created entity while mapping to the table entity.
After that i add scalar property name for key value to the newly entity to map to the table entity. Again i build the project i got another error which is both the entites have the same key value.
i need to import the Select Query based stored-procedure using the entity framework 4.