Solved

Entity Framework and Linq queries

Posted on 2014-01-15
3
293 Views
Last Modified: 2016-02-10
Hi guys,

Ok this is a bit of a general question. We started using entity framework, dragging the tables across from the data source window (as grids) and letting EF do the binding. But this soon started getting messy with links and removing all auto generated code when removing grids etc. So I started to write Linq queries linking to EF and populating the grid with the Linq results.

Will we run into problems with this if 2 users fire the same query to the database at the same time or will EF manage this? in terms of saving data and returning a unique ID

My boss asked a valid question in that why are we using EF if its not doing the binding for us and why don't we go back to our own method of doing our own database connection, firing SQL queries, getting results and closing database connection?

I know this is an odd question but I was just looking for general advice and possibly your opinions on how you do things.
0
Comment
Question by:deanlee17
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
Imran Javed Zia earned 500 total points
ID: 39781929
Yes EF take cares of auto generated/identity fields in dbms like sql server and etc, but you may have to address them manually in dbms like oracle.

 
It all depends on your requirement, please refer to following general discussions:
http://www.bishoylabib.com/2012/01/why-entity-framework-is-better-than-ado.net
stackoverflow.com/questions/9811106/entity-framework-vs-ado-net
http://forums.asp.net/p/1686009/4441548.aspx?EF+Frustrations

Thanks
0
 

Author Comment

by:deanlee17
ID: 39782273
Great info in the links. Ok so if I had a scenario where I have 2 users uploading 10,000 records at once it would complete one users database inserts before moving on to the second user?
0
 
LVL 16

Expert Comment

by:Imran Javed Zia
ID: 39782373
As per my understanding, either you use ado.net or EF, in such scenario, you have to manually implement transactions or semaphore (lock statement) as per requirements.

Like if there is requirement that when 1st batch is in process then the 2nd batch may not execute in such case you may use semaphore, alternatively you may use transaction.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now