Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 841
  • Last Modified:

Adding rows to table in Entity framework

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
hamid441
Asked:
hamid441
1 Solution
 
avirupsCommented:
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
 
Mark WillsTopic AdvisorCommented:
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
 
hamid441Author Commented:
thanks both of you...
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now