Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Adding rows to table in Entity framework

Posted on 2010-09-22
3
Medium Priority
?
839 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 2000 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

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…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

660 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