Quantcast
Channel: EntityFramework Reverse POCO Code First Generator
Viewing all articles
Browse latest Browse all 1642

Commented Unassigned: Many-to-many does not use proper naming [182]

$
0
0
It appears that in a many to many relationship, the first navigational property should be the plural without the foreign key and without "1" appended but in version 2.19 this does not happen.

For instance, we have the following tables:
* Roles
RoleId

* Permission
PermissionId

* RolePermission
RoleId
PermissionId

In the generated Role class, instead of a "Permissions" property in the reverse navigation , we get a property for "Permissions_PermissionId" and another for "Permissions1".

Similarly, in the generated Permission class we get properties "Roles_RoleId" and "Roles1".

It seems like the intention was to have a result where the Role class would have a property named "Permissions" and a second one named either "Permissions1" or "Permissions_PermissionId" - which would be fine if that was the result.

Comments: It appears that the error is in the POCO.Core.ttinclude with the conditional: if (!ReverseNavigationUniquePropNameClashes.Contains(tableNameHumanCase) && !ReverseNavigationUniquePropName.Contains(tableNameHumanCase)) { ReverseNavigationUniquePropName.Add(tableNameHumanCase); return tableNameHumanCase; } Which sees the name clash so the normal and probably intended naming doesn't happen on the first instance.

Viewing all articles
Browse latest Browse all 1642

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>