Answered by:
Need help for implementing Entity framework with my brown field project?

Question
-
I have brown field project (It is enterprise application). I have used layered architecture to develop the system. In Data access layer I have used ADO.net to perform db related operations.
Now I want to incorporate Entity Framework with my existing project. I want to implement EF Code first. As I am interested to code first, I have created all of my entities using POCO generator in separate project.
As I know for performing Unit Testing, Repository pattern will great so want to incorporate repository pattern.
In repository pattern there is no concept of Stored Procedure. But my existing project has lots of stored procedure. So my question is, How I can use Repository pattern with Stored Procedure? Is it possible to use both? If no then what I will do?
What will be best? Shall I use Simple EF? Or repository pattern? Please help me!!!
Hasibul Haque,MCC,MCPD hasibulhaque.com
Wednesday, June 27, 2012 10:18 AM
Answers
-
Hi Hasibul Haque,
Here's a tutorial about how to use EF with MVC, at the part9, it will lead you to implement Repository Pattern and Unit Of Work Patterns in MVC. Please refer to the link below.
http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc
Best Regards
Allen Li [MSFT]
MSDN Community Support | Feedback to us
- Marked as answer by Allen_MSDN Monday, July 9, 2012 2:39 AM
Wednesday, July 4, 2012 2:05 AM
All replies
-
On 6/27/2012 6:18 AM, Hasibul Haque wrote:> I have brown field project (It is enterprise application). I have used> layered architecture to develop the system. In Data access layer I have> used ADO.net to perform db related operations.>> Now I want to incorporate Entity Framework with my existing project. I> want to implement EF Code first. As I am interested to code first, I> have created all of my entities using POCO generator in separate project.>> As I know for performing Unit Testing, Repository pattern will great so> want to incorporate repository pattern.>> In repository pattern there is no concept of Stored Procedure. But my> existing project has lots of stored procedure. So my question is, How I> can use Repository pattern with Stored Procedure? Is it possible to use> both? If no then what I will do?>> What will be best? Shall I use Simple EF? Or repository pattern? Please> help me!!!>A repository pattern is a design that is not limited to EF.
- Proposed as answer by Allen_MSDN Thursday, June 28, 2012 2:01 AM
- Marked as answer by Allen_MSDN Monday, July 2, 2012 2:28 AM
- Unmarked as answer by Hasibul Haque Monday, July 2, 2012 4:02 AM
Wednesday, June 27, 2012 7:43 PM -
thanks darnold924,
Looking answer from others.... still waiting for response..
Hasibul Haque,MCC,MCPD hasibulhaque.com
Monday, July 2, 2012 4:02 AM -
On 7/2/2012 12:02 AM, Hasibul Haque wrote:> thanks darnold924,>> Looking answer from others.... still waiting for response..>> ------------------------------------------------------------------------You do know that you can use a Repository pattern with ADO.NET, SQLCommand objects, a sproc, datareader, custom objects and not need EFperiod.Monday, July 2, 2012 4:42 AM
-
Hi Hasibul Haque,
Here's a discussion on stackoverflow to talk about Repository Pattern with Stored Procedure, please refer to the link below. I think it could help. : )
http://stackoverflow.com/questions/9333115/repository-pattern-and-stored-procedure
Best Regards
Allen Li [MSFT]
MSDN Community Support | Feedback to us
Tuesday, July 3, 2012 3:12 AM -
Thanks for making replay, I know i can use ADO.net, SQL Command Objects etc instead of EF.
Actually i want to Use EF and SP in such a way so that i can perform Unit test.
Can you give guideline how i can achive this? or any tutorial or link?
Suppose i am using EF for ms sql, now if i want to use oracle or my sql instead of ms sql then what i have to do? How i can make my Business Layer independent so that i can use any data base through EF?
Hasibul Haque,MCC,MCPD hasibulhaque.com
Tuesday, July 3, 2012 5:02 AM -
Hi Hasibul Haque,
Here's a tutorial about how to use EF with MVC, at the part9, it will lead you to implement Repository Pattern and Unit Of Work Patterns in MVC. Please refer to the link below.
http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc
Best Regards
Allen Li [MSFT]
MSDN Community Support | Feedback to us
- Marked as answer by Allen_MSDN Monday, July 9, 2012 2:39 AM
Wednesday, July 4, 2012 2:05 AM