EF Projects Generate Pluralized DbSet Property Names but Singular ConceptualModel/EntitySet Names

Posts   
 
    
Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 10-May-2015 22:47:58   

I'm using the WCF Data Services and have run into a problem with pluralisation. My table names are plural and I'm using the default LLBLGen Designer Event Binding to convert Plural table names into Singular entity names. That's fine.

The DataContext source file that is generated is producing DbSet<T> properties which are plural. That's good too.

However, the EDMX file that is generated is producing EntitySet elements under the edmx:ConceptualModel with Name attributes that are singular and this is causing my WCF Data Service to produce URLs in the singular form to represent entity sets! I've confirmed this by hand-editing the EntitySet element Name attributes in the generated EDMX to use plural names (and then editing all the EntitySetMapping elements under the edmx:Mappings element to match) and then rebuilding my Persistence project and WCF Data Service project to see that the URLs are pluralized.

How do I make LLBLGen generate plural EntitySet Name attributes in the EDMX? As far as I'm concerned they should match the names used in the DataContext properties.

Using v4.2 Feb 16 2015. .NET 4.5. I've tried with both EF5 and EF6 - same result.

Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 11-May-2015 02:19:54   

Emmanuel wrote:

the EDMX file that is generated is producing EntitySet elements under the edmx:ConceptualModel with Name attributes that are singular

I found an old thread from 2010 (http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=18507&HighLight=1) that seems to be referencing the same issue but which Frans indicated was behaviour that would not be changed.

Can I get a comment on how I can solve this problem?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 11-May-2015 11:54:33   

This is indeed unfortunate. The main issue I think is that it was originally designed to have all singular names, but we fixed that but forgot the edmx internal names. These aren't available outside the EDMX, however are problematic with the wcf data service it seems as it leverages these names.

If you generate code using the Code First preset, you should be able to work around this, as you then don't get an edmx (it's regenerated by entity framework internally at app startup). Could you try that for me please?

If you want to keep using edmx (or have to, due to limitations in EF6's CF), you have to alter the template but the names of entities are in a lot of places so it's not that simple. We can't change it now as it's a breaking change. If CF works around it, I'd go that route.

Frans Bouma | Lead developer LLBLGen Pro
Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 11-May-2015 18:22:43   

Otis wrote:

If you generate code using the Code First preset, you should be able to work around this, as you then don't get an edmx (it's regenerated by entity framework internally at app startup). Could you try that for me please?

I tried this and got an exception: 'Unable to load the specified metadata resource' when attempting to access the svc URL.

Otis wrote:

If you want to keep using edmx (or have to, due to limitations in EF6's CF), you have to alter the template but the names of entities are in a lot of places so it's not that simple.

Indeed I tried changing the template but gave up after seeing how many other places (associations and mappings, etc) the names are used.

I'm afraid I've spent too much time with this problem. I've moved onto using the Visual Studio Database First Modelling instead rage I'll continue to use LLBLGen for my other LLBLGen-framework project though simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 12-May-2015 09:35:38   

Emmanuel wrote:

Otis wrote:

If you generate code using the Code First preset, you should be able to work around this, as you then don't get an edmx (it's regenerated by entity framework internally at app startup). Could you try that for me please?

I tried this and got an exception: 'Unable to load the specified metadata resource' when attempting to access the svc URL.

Did you use the right wcf dataservices dll ? They have updated the one shipped with vs.net to support code first.

Otis wrote:

If you want to keep using edmx (or have to, due to limitations in EF6's CF), you have to alter the template but the names of entities are in a lot of places so it's not that simple.

Indeed I tried changing the template but gave up after seeing how many other places (associations and mappings, etc) the names are used.

I'm afraid I've spent too much time with this problem. I've moved onto using the Visual Studio Database First Modelling instead rage I'll continue to use LLBLGen for my other LLBLGen-framework project though simple_smile

Hmm, very sorry to hear you have to use that horrible designer instead and we couldn't help you disappointed

Frans Bouma | Lead developer LLBLGen Pro
Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 12-May-2015 13:54:55   

Otis wrote:

Did you use the right wcf dataservices dll ? They have updated the one shipped with vs.net to support code first.

Good question. When I have time I'll investigate.

Hmm, very sorry to hear you have to use that horrible designer instead and we couldn't help you disappointed

Indeed. I already am having LLBLGen Designer withdrawal symptoms. I'll give it another try when I have less of a deadline crunch and hopefully I can get back to using LLBLGen (code first) with EF6.

Edit: I'm leaving this thread open for now. I'll report back after I've had time to try this again with the correct Microsoft.Data.* assemblies that support code-first.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 12-May-2015 17:27:54   

simple_smile Yeah wcf data services is a bit of a mess, so it's easy to get the wrong dlls. You have to use the last 5.x versions from nuget, if you want odata v1-3 and the v6.x if you want odata v4.

hopefully you'll be able to make it work so you don't have to fight the ef designer wink

Frans Bouma | Lead developer LLBLGen Pro