Solved

LINQ to Entity - Update from Database/Alternative

Posted on 2011-02-28
9
714 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
[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
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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:Tom 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Upgrading my SSIS package in VS 2012 6 89
c# DateTime Format validation 4 69
Set custom font WPF 2 21
Stop Git from being my repository 1 25
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

733 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