Solved

LINQ to Entity - Update from Database/Alternative

Posted on 2011-02-28
9
709 Views
Last Modified: 2013-11-11
I am using the LINQ to Entity framework with VS 2010(C#). But there is a issue that every time database gets updated, I have to go and manually update edmx file from database. It is a running windows service, therefore it can crash the application.  Is there any other way that edmx file can be updated automatically or I have to use Entity framework without using edmx file but create some edmx conceptual look alike file and run query and stored procedures using sql.
Please help.
0
Comment
Question by:Masterabhi
  • 4
  • 2
9 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 35004000
Hi Masterabhi;

I have never tried this before and so I ran a couple of test. I added and extra column to the database table and my test program ran the query with no problem. I then moved a column in the table and ran the program again and it still ran with no problem.

So what do your queries look like? Can you post then? Where does the program crash?

As far as keeping the model in sync with the database you will need to update the model through the designer.

Fernando
0
 

Author Comment

by:Masterabhi
ID: 35010433
I want to get my .edmx  updated automatically whenever there is a change in database.
I have a running windows service which uses linq to enitity to access data from database.
So if there is a change in database, in this case I have to stop the service , go into my code, and do update the model from database in my edmx file to keep this file in synch with database changes.
I don't want to stop my service in the middle, whenever there is a change in database.
Is this possible to do?
Is there any other alternative I can use?
0
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 35010837
The EDMX is a strongly typed model so in order to update it to the updated structure of the database you need to recompile the program after manually updating the EDMX.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:Masterabhi
ID: 35109969
Does that mean, there is no way I can update my model automatically?
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 35110034
Correct.
0
 
LVL 5

Expert Comment

by:knowlton
ID: 36115939
I've requested that this question be deleted for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 36115940
Hi Moderator;

Please note that this question has been answered. Please look at the last two post. Seeming that the question has been answered the points should be awarded.

Thanks;
Fernando
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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

831 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