Linq to SQL or Entity Framework for Enterprise ASP.NET MVC?

I'm still trying to figure out the right architecture for a complex ASP.NET MVC web application.

I looked through a lot of code examples and wherever it was done differently.

I would really appreciate your thoughts on this.

Another question: are you using Linq for SQL or Entity Framework?

Thanks,

-Ben

+6
architecture asp.net-mvc linq-to-sql
source share
5 answers

Check out Architecture Guide: ASP.NET MVC + N-Level + Entity Structure and More

If you want to use ASP.NET MVC, but you are struggling to ensure that you are sure to use it for your next business project. This article is for you only. In this article, you are invited to use ASP.NET MVC to create a small document management system.

+3
source share

Some personal thoughts and experiences:
- use nhibernate as orm or wait for EF v4. Tekpub.com has a good tutorial on using NH. L2S and EF are a black box: they do a lot of things, they have good documentation, but they do not have an extensibility point. If you want to connect some new features or change the behavior, you can only do this with NH. EF in v4 will be able to when NH was 2 or 3 years ago.
- Browse as many sample MVC applications as you can find. You can find many of them on codeplex. For example: CodeCampServer, WhoCanHelpMe, Storeddd
- if you are thinking of creating a framework (or assistant) to solve some problems with the infrastructure, first contact him; this is a high probability that someone else is smarter than you (well, smarter than me in my case) already had the same problems, and wrote a good piece of code in the form of a framework (mapper object, validation, messaging, ...) or just a blog about it.
- Using sharp architecture, or fubuMvc solves most of the infrastructure, but the rest of the application depends on your business model.
- TDD will force you to write good and convenient code. Try to use the Gang of Four design templates and SOLID principles as much as possible.

+4
source share

Since you are going to use the MVC application, you can easily write a DataAccess layer below the Controller level. This will make it a layered application . Thus, this may be a suitable option for your architecture.

For a LinQ-SQL or Entity Framework question, I used only Entity frameworks. Therefore, I am not sure about the Linq to Sql option. However, when changing the schema, there are certain problems with the Entity Framework. Updating generated edmx does not happen properly when columns are renamed, etc. So what I do is delete and create edmx after each schema change, and you need to manually update the changes there.

+2
source share

Can I use Linq for SQL or Entity Framework?

Linq2SQL is great if you want to access an object model that maps directly to your database. For example, if you have a Orders table, Linq2SQL will create an Orders object that you can use to access data. This is often quite adequate.

Entity Framework is useful when you want to create an object model that cannot be directly displayed in the database.

+1
source share

Everywhere there are different, that’s why. There is no single answer to this question. Look at other approaches and take whatever you find useful for your situation.

0
source share

All Articles