Solved

Adding rows to table in Entity framework

Posted on 2010-09-22
3
825 Views
Last Modified: 2013-11-11
Hi all,
I am writing an application that reads xml files and imports data to sql server 2008 database. I am using entity framework in VS2010 . I can add rows to tables in two ways
1. use stored procedures
2. use entity framework objects by creating an row entry object and inserting it to the db.
 ex:
  SystemTable st = new SystemTable();
   st.Name = "aaaaa";
   database.AddToSystemTable(st);
   database.SaveChanges();


 here is my question:
Which approach do you suggest? Is there any performance difference?
0
Comment
Question by:hamid441
3 Comments
 
LVL 8

Expert Comment

by:avirups
Comment Utility
Adding rows in a table will always be faster using stored procedures. Keep it within the database engine scope and it will be significantly better if you can measure it.
0
 
LVL 51

Accepted Solution

by:
Mark Wills earned 500 total points
Comment Utility
Yeah, keep it all on the server in Stored Procedures - you have a degree of flexibility by being able to enhance the stored procedure if needed without too much impact.

Also keeps server objects on the server and can tune / control performance a bit more. Especially important as data changes with volume over time.
0
 

Author Comment

by:hamid441
Comment Utility
thanks both of you...
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

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…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
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 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: …

763 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

9 Experts available now in Live!

Get 1:1 Help Now