U
U
User992018-12-07 08:54:26
ASP.NET
User99, 2018-12-07 08:54:26

How to work with the database besides Entity FrameWork in ASP.NET MVC?

How and what else can you work with MS SQL Server database in asp.net mvc? Preferably familiar SQL, in PHP, for example, it’s very easy and understandable for me to get used to EF, please tell me SQL similar, or is it possible to use SQL? online materials are mostly about EF. SELECT * FROM TABLE WHERE ID='$recid'

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander, 2018-12-07
@User99

1) Roll into EF. It is more successful, at least because: it builds complex queries for you; the error is immediately visible; spits out the target object immediately (including related ones - the so-called lazy loading); has providers for all conceivable and inconceivable storages, reducing them to a single interface.
2) Write requests manually on EF or on EFCore

M
mletov, 2018-12-07
@mletov

1) This is how people worked before the advent of any ORM
https://metanit.com/sharp/adonet/
2) EF also allows pure sql.
The syntax for EF5 and EF6 is different
https://www.google.ru/search?newwindow=1&safe=stri...

D
Dmitry Kovalsky, 2018-12-07
@dmitryKovalskiy

Materials on the net on EF because it is trendy, simple and does not require knowledge of SQL. If you are well versed in database architecture and know how to write optimal SQL queries using indexes and query plans. That I advise, as told mletov to write through ADO.NET.
My personal approach is to call stored procedures using SQLConnection and Dapper, allowing for asynchrony (although in fact - pseudo-asynchrony)

S
Stanislav Makarov, 2018-12-07
@Nipheris

ADO.NET has been the dominant relational data access technology on the dotnet since its inception.
EF, and perhaps a little less than all the dotnet ORMs (the same NHibernate) work on top of ADO.NET, this is clearly seen, for example, in the fact that you can pass an ado connection object.
https://docs.microsoft.com/en-us/dotnet/framework/...
so you should be clear that EF wraps a lower level ADO.NET and you can use it directly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question