Solved

advice on website architecture .net 4

Posted on 2012-03-14
2
191 Views
Last Modified: 2012-06-27
Hi,

I'm an experienced web developer and am used to having strongly typed classes with a business and datalayer.

I'm wanting to get into interfaces and entity framework 4 so am looking at putting my first project(s) together after my bit of research.

My plan is to have a generic repository within my DAL project which will have its own interface.

In terms of my objects then.... Do I have them in their own library pulling from one.edmx and then the DAL project would have another instance of the same .edmx.

Obviously I would need access to the objects in my fron end project too and am a but unclear about how to go about putting this all together in a correct way.

Swift advice would be appreciated.
0
Comment
Question by:scm0sml
2 Comments
 
LVL 15

Accepted Solution

by:
navneethegde earned 250 total points
ID: 37723622
Hi!

1. Have one class library project MyEntity with emdx inside it.
2. And Use Model class Library to Have your POCO Classes.
3. You can Connect Model and myEntity using T4 Template.
4. Use Repository Pattern ovr this


http://blogs.msdn.com/b/adonet/archive/2009/06/16/using-repository-and-unit-of-work-patterns-with-entity-framework-4-0.aspx


Thanks!
0
 
LVL 22

Assisted Solution

by:ambience
ambience earned 250 total points
ID: 37724189
Like me you've hit a stumbling block because of trying to mix EDMX and Repository patterns. My thoughts so far:

The Repository pattern looks like a good pattern with Code First strategy, where you have POCO domain objects and don't probably want to annotate them with persistence specific attributes and completely shield away persistence. POCOs are what you'd use in the Repository contracts.

Using ModelFirst or Database first however is somewhat a different story - because the domain objects are not as such in your control. You can put the EDMX in the Contracts assembly but not map the models to any store, or delete the mapping if you started with database first mode. The generated POCOs would have strong dependencies over Entity Framework attributes and objects (will have to live with that or delete manually).

Then in each assembly you can map to a database. The way to do that would be to copy the EDMX to the project, complete the mapping to specific database and then delete the CSDL and keep only the MSL and SSDL as resources.

EF metdata string needs paths to CSDL, MSL and SSDL as well as embedded connection string that the provider would use. This should work

metadata=C:\Entities.csdl|C:\mysql\entities.ssdl|C:\mysql\entities.msl

I'm sure there would be a syntax for loading the ssdl and msl from implementation specific DAL assemblies. I dont actually see a need for different DAL assemblies as such, because a single ObjectContext would work given different mapping files.

I hope that helps ...
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Video Player 11 23
Hey Audio! 3 30
updating order of the rows, N+1 query issue, C#, asp.net, MVC, SQL Server 3 27
Calculate number of nights between two dates 5 29
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question