views:

45

answers:

2

hi all,

i want to learn entity framework. i started with some EF tutorials and i also know little about linq to sql.

i want to learn through a pet project. project should be in three layers. web forms (prez), data layer(c# lib), bussiness layer(c# lib). Project can be any, any functionality. just want to learn how to use EF in diff. layers and in UI.

can anyone guide me how do i start to do layering? help me to learn how should i use EF objects from DAL layer to BL and then UI.

I am confused as all tutorials shows direct binding of EF to EF datasource in UI and with controls.

thanks a lot.

A: 

A couple of things I would recommend:

  • Rob Conery (with occasional guests) put together a video series on building a storefront site using ASP.NET MVC. He used LINQ-to-SQL, not Entity Framework, but I don't think the difference is significant to what you are interested in learning. One nice thing about this series is that he walks you through the various design decisions he makes, and even backtracks when he later feels that one of them was wrong. Another is that, in addition to MVC and LINQ-to-SQL, he also explores some other development concepts such as inversion of control and test-driven development.

  • Martin Fowler's book Patterns of Enterprise Application Architecture is a great resource for this sort of thing. He lays out the different patterns that are available in each tier of your application and discusses how to use them and when each is appropriate. Fowler's writing style is friendly and easy to read, and a lot of the patterns in his book are prominent in the vernacular of the software development world today (e.g. Repository pattern, Active Record, Unit of Work).

Hope this helps!

Matt Peterson
thanks. but i want to start with EF and with sample pet projects.
cache
@cache: do that ASP.NET MVC Storefront - but with EF !
marc_s
I'd also recommend Julie Lerman's blog: http://thedatafarm.com/blog/,Alex James blog: http://blogs.msdn.com/b/alexj/ and the EF design blog as further reference http://blogs.msdn.com/b/efdesign/.
Yakimych
+1  A: 

In order to maintain a layered architecture I would create partial classes of the generated EF Classes. In these classes I would have methods I could use with objectdatasources in the presentation layer. Thats how I do it anyways, hope it helps!

Mike