Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating Model from Database doesn't work
Message
De
25/11/2012 02:59:55
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Divers
Thread ID:
01557270
Message ID:
01557947
Vues:
44
>>>>>>Hi,
>>>>>>
>>>>>>I am using VS 2008 and .NET 3.5
>>>>>>
>>>>>>I generated an Entity Data Model from my database successfully. I had to make some changes to the database (dropping a field and adding another to one table) and so I went back into the Entity Data Model and selected to Update Model from Database, but it doesn't do anything. I even tried deleting the affected table but that doesn't show up in the list of tables to add.
>>>>>>
>>>>>>Any ideas how to do this?
>>>>>
>>>>>
>>>>>Has no one else ever encountered this?
>>>>
>>>>I've found this to be erratic at times :-}
>>>>Usually new fields show up.
>>>>But deleted fields are not removed. This, however, isn't a big problem since you can just remove the field in the designer.
>>>>Changing a field name results in the same thing - a new field is added with the new name but the old field is still there....
>>>>Bigger problems occur if, for example, relationships change....
>>>>
>>>>All in all, it works great if you create from a stable database design (or create the DB from the model) - but if you are making frequent changes to the DB you'll eventually find yourself having to tweak the XML to avoid having to create a complete new model :-{
>>>
>>>Thanks I had found an example of how to tweak the xml yesterday and got that part working. What a pain!
>>
>>When I initially started down the Entity Framework path I was fairly excited.
>>
>>Then reality set in. If you never change your schema (yeah - right), then it is convenient unless you use stored procedures. If you ever change your schema, all bets are off and you save time by NOT using EF.
>>
>>Haven't touched it since.
>
>I read your point and appreciate the practical implications of using EF. But I can't think of any real world application where the DB schema never changes. How come then so many people are using EF?

>Don't they see the pitfalls of using EF?

Yes, but they also see the benefits :-}

Thinking of your current issue, you may find it simpler for the moment to write a SQL View and use that in the entity model - easier to handle than SP's and will also, as long as the results of the view do not change, shield EF from other changes to tables used in the View.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform