home recent topics recent posts search faq  

Huagati Systems Support Forum



register | lost password   open id sign in with Twitter
Messages in this topic - RSS

Home » Huagati DBML/EDMX Tools Support » Associations naming problem

Support forum for Huagati DBML/EDMX Tools
5/13/2010 10:16:25 AM

amiram
amiram
Posts: 13
Hi,
I found a naming bug in the associations naming. If you have to foreign keys in a table from a single table, one of them is named with "By" which is very good comparing to VS that uses only a number suffix. But, imagine the following scenario:
1. City table - ID int PK, CityName nvarchar.
2. Person table - ID in PK, PersonName nvarchar, HomeCityID FK from City.ID.
Now Person gets a property named City, and City Gets a property named Persons (EntitySet).
Now go back to the database, delete column Person.HomeCity and add column Person.WorkCity with FK from City.ID.
Update the dbml again. You should get the same properties - Person.City and City.Persons because HomeCity column does not exist anymore, but this is the output:

Updating Linq-to-SQL classes from database schema...
Removed member HomeCity from class Person corresponding to removed field dbo.Person.HomeCity
Added member WorkCity to Person (dbo.Person.WorkCity)
Added association CityByWorkCity to Person corresponding to foreign key constraint FK_Person_City.
The underlying foreign key for association City_Person on table Person is no longer in the database. Dropping association.
Added association PersonsByWorkCity to City corresponding to foreign key constraint FK_Person_City.
The underlying foreign key for association City_Person on table City is no longer in the database. Dropping association.
Completed updating the Linq-to-SQL classes from the database.


As you can see, the tool add the new WorkCity association before deleting the deleted HomeCity association, so you get unnecessary long names Person.CityByWorkCity and City.PersonsByWorkCity.
This happened to me many times in my main project. Obviously, a temporary solution is to delete one of the tables from the dbml diagram and update again.

Thanks
0 permalink
5/18/2010 10:46:41 AM

Kristofer Andersson
Kristofer Andersson
Moderator
Posts: 331
Hi,

You're right, it would make sense for the add-in to remove associations (for dropped FKs) before adding new ones. I will look into changing that in an upcoming version...

Best regards,
Kristofer
0 permalink

Home » Huagati DBML/EDMX Tools Support » Associations naming problem





Powered by Jitbit Forum 7.1.0.0 © 2006-2011 Jitbit Software