简体   繁体   中英

LINQ or something else?

I recently left a small company where we were writing .NET MVC apps using LINQ2SQL for data access to take a new position. Here they are still using web forms and an in house written ORM, but are looking to move to MVC and possible LINQ2SQL here in the near future. I personally liked everything about LINQ2SQL except for the problems you run into when you make changes to a table (adding a column or something) and having to regenerate the dbml file everytime.

1) Has that issue already been worked out or does anyone know if Microsoft is planning on resolving that issue?

2) If we were going to use something other than LINQ2SQL here for our new data access layer, what would everyone's suggestions be?

The current MS push is towards Entity Framework. Why? Because, frankly, LINQ to SQL was a kludge thrown in due to EF being delayed. I love LINQ as a means of "iterating" (not quite true, as it works on rX instead of enumerations, but that is probably getting a bit too technically specific).

If you want to head where MS is heading, I would aim for EF. I, personally, find some issues in the current iteration, but it is getting better. Your mileage may vary.

If that is not the way for data access, I would consider a non-custom OR Mapper. There are tons of them out there, many of which have a long history and are stable enough to recommend for Enterprise use (nHibernate, as an example). Maintaining a custom OR Mapper is more work than a team should incur, unless it is absolutely necessary.

This is liable to get subjective, but if (1) is an issue and you can opt for a third-party product the Developer Express Express Persistent Objects has an interesting solution. This allows transparent updates to the database, where possible, when the model changes. It's been around for a very long time and is stable.

Entity Framework is now promoted by Microsoft as their ORM, the older LINQ to SQL technology is rapidly becoming deprecated. EF is under heavy development and will undoubtedly improve.

You definitely want to move away from an in-house ORM.

  1. Well, the latest version of Entity Frameworks supports "code first", where the database is created automatically from your business objects. But the model still needs to be regenerated any time the model changes. So I'm not really sure what you're looking for here.

  2. Entity Frameworks.

Entity Framework allows you to update from the database. All you need to do is right click in the edmx file and select 'Update Model from Database'. It is a quick replacement for Linq2SQL and you can access it the same way. There are only a few small changes between the two.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM