Solved

Adding rows to table in Entity framework

Posted on 2010-09-22
3
829 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
ID: 33740139
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
ID: 33741602
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
ID: 33745134
thanks both of you...
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

786 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