What can map database tables like LINQ to SQL?

The good thing about LINQ to SQL is the fast and reliable way to map database tables and convert them to classes accessible from a C # project. However, creating projects using LINQ to SQL is no longer recommended.

What is its replacement? What tool should I use in VS 2010 today if I want to have the same functionality as with LINQ to SQL?

+4
source share
3 answers

Why not??

Linq-to-SQL is still in .NET 4, even with fixes and improvements . For small projects, this is still a very viable solution!

Yes, it will not have much further development, but it is still there, it is still working, and for many projects it is perfect - just use it !

If you want to have something “secure future”, you need to look at Entity Framework v4.

See this blog post for tons of links to EF4.

EF4 looks very promising, but remember: it always represents a two-step matching process (while Linq-to-SQL is a direct 1: 1 mapping from table to object). This can be great if you need flexibility, but it can be a drawback as it adds some overhead.

If you really don't want to use Linq-to-SQL, you can also check out SubSonic , which is another simple, easy to use, simple 1-dimensional OR-mapper

+7
source

I will try Nhibernate. I think it works great, never used EF4, so it can't compare. Nhibernate forces you to manually declare all mappings, but they are very lightweight and quickly fail and do not have some restrictions on the use of the classes generated by LINQtoSQL. It also depends on your preferences, but I like to have full control over the classes that I generate and the interfaces that I implement to them. The syntax may take some time to get used to, but I think this is a really powerful tool.

http://nhforge.org/

Also some amazing video tutorials on how to use it can be found here: http://www.summerofnhibernate.com/

0
source

What you may have heard is that Microsoft will spend its development efforts on the Entity Framework instead of LINQ to SQL. Entity Framework is what you should consider as a replacement for LINQ to SQL.

Although EF does not require a one-to-one mapping in the database, this is the default when you create a new EF model from the database. Thus, it will be equivalent to LINQ to SQL.

0
source

Source: https://habr.com/ru/post/1305919/


All Articles