Solved

Entity Framework and Linq queries

Posted on 2014-01-15
3
299 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

816 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

12 Experts available now in Live!

Get 1:1 Help Now