ASP.net MVC - OneToOne relationship with pluralized nomenclature
Posted
by ludicco
on Stack Overflow
See other posts from Stack Overflow
or by ludicco
Published on 2010-05-26T17:02:16Z
Indexed on
2010/05/26
18:31 UTC
Read the original article
Hit count: 372
Hi, I have an OneToOne relationship between my models Account and Company the table names are Accounts and Companies respectively.
Here is a brief screenshot of the structure: http://cl.ly/1AEU
Everything works well, but mysteriously when I use the OneToOne associations I have accessors like:
var db = new DB();
var account = db.Accounts.First();
var company = account.Companies; // note the plural not the singular accessor
So, what's happing is that even if using OneToOne association, I still get the plural accessor with "companies" and not "company", if it this is a pure object representation and not an EntitySet generated in case when it s an oneToMany relationship.
Is there a way to get this nomenclature to be applied properly?
Thanks a lot
© Stack Overflow or respective owner