How Do I Modify the Plural Names of Top-Level Queries in the Generated Entity Framework DataContext class?

Posts   
 
    
Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 10-May-2015 14:38:48   

My entities defined in the designer are singular names and I see that LLBLGen is generating plurals for their DbSet collections in the generated DataContext class. However, some of the plural forms are incorrect grammar and I'd like to fix that.

How do I override the default plural form of singular entity names in the designer so that generated code uses the plural names I want?

I'm using v4.2 Final (Feb 16 2015).

Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 10-May-2015 14:42:05   

Emmanuel wrote:

My entities defined in the designer are singular names and I see that LLBLGen is generating plurals for their DbSet collections in the generated DataContext class. However, some of the plural forms are incorrect grammar and I'd like to fix that.

How do I override the default plural form of singular entity names in the designer so that generated code uses the plural names I want?

I'm using v4.2 Final (Feb 16 2015).

I thought I'd found the solution (click "New sequence..." in the entity's "Field Mappings" tab. But when I generate code, it still uses the default plural name.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-May-2015 22:13:14   

Hi Emmanuel,

If the pluralization of collections doesn't suits you, you could just rename those navigators individually in the LLBLGen Designer. The pluralization will run again for new elements, not for the one you just renamed.

If you want to totally disable the pluralization plugin's event, you can do it as well, this is how.

You could even download the SourceCode package from the LLBLGen's Customer section and modify the Singularization/PlurarizationPluglin to your needs (adding additional grammar exceptions, for instance).

David Elizondo | LLBLGen Support Team
Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 10-May-2015 22:48:40   

daelmo wrote:

If the pluralization of collections doesn't suits you, you could just rename those navigators individually in the LLBLGen Designer. The pluralization will run again for new elements, not for the one you just renamed.

But how do I rename them at the top-level? In other words, the ones that result in the generation of DbSet<TEntity> properties of the generated DataContext?

(Also, just discovered another pluralisation issue. See http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=23328)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 11-May-2015 12:03:56   

The pluralization is done through the plugin. If some names aren't pluralized properly, I'd look at the plugin source (it's shipped with the sourcecode archive, available in the customer downloads on the website) It's a straightforward piece of code which works with a set of exceptions together with a general pluralization algorithm (it's OSS code actually from the castle lib).

Would that work for you?

Frans Bouma | Lead developer LLBLGen Pro