Where can I get good tutorial on Entity framework with Stored Procedure in MVC framework?
Is it better to use Enterprise library in this case when I have almost everything written in the stored procedure.
Note: I am using stored procedure because they are really very complex and some of them is over 1000 lines.
MVC is in this case absolutely not related. The way how you call stored procedure from EF will be still the same. I guess you want to use stored procedures without actually using entities and linq-to-entities (main EF features), don't you? Generally you need:
ObjectContext
and all entities by default.ObjectContext
which will allow you call the stored procedure as any other .net method.You also don't have to use function imports at all and you can execute procedures directly by calling either:
objectContext.ExecuteSqlCommand("storedProcedureName", SqlParameters)
for SPs not returning record setobjectContext.ExecuteStoreQuery<ResultType>("storedProcedureName", SqlParameters)
for SPs returning record set. ResultType
must have properties with same names as columns in result set. It can work only with flat types (no nested objects).There are some limitations when using stored procedures: