?
Solved

advice on website architecture .net 4

Posted on 2012-03-14
2
Medium Priority
?
199 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
Navneet earned 1000 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 1000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

764 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