Solved

Adding rows to table in Entity framework

Posted on 2010-09-22
3
834 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
In this article I will describe the Backup & Restore 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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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