views:

58

answers:

1

Hi,

I have 2 tables: Bikes and Wheels. Bike has 2 FKs to Wheels: Bike.FrontWheelID and Bike.BackWheelID. EF maps these onto Bike.Wheel and Bike.Wheel1, just using their type for name, which I would prefer to avoid.

Is there a way to change this that would survive further regenerations of model from db schema? (some setting perhaps?)

Thanks

+2  A: 

You can rename those properties in Entity Model Designer and it will not affect further regenerations of the model.

Yury Tarabanko
Hm, but to regenerate the model I often need to delete the existing one and generate it from scratch, and not update the model. For example when I rename a field in db model. Wouldn't this delete the model designer? Am I missing something?
Massive Boisson
Yea, the part where you delete the model and regenerate from scratch... what is your justification for needing to do that?
Nix
@Massive Boisson: Well, when you recreate the model from scratch all changes will defenitely be lost. What about @Nix question?
Yury Tarabanko
If I have table Bikes.FrontLightName, I get the Bike class with property frontLightName. If I change that name to Bikes.FrontLightMake, and do the Update Model From Database, it creates a new column frontLightMake, leaving the old there as well (frontLightName).
Massive Boisson
It should be OK for navigation properties. Give it a try :)
Yury Tarabanko
Yury thanks, but the method I described above does not work. The data ends up not being correct. I end up with both properties: frontLightMake and frontLightName in Bike class.I just doublechecked it. Am I doing something wrong?
Massive Boisson