Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

advice on website architecture .net 4

Posted on 2012-03-14
2
Medium Priority
?
200 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

597 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