UmbracoLinqPadDriver icon indicating copy to clipboard operation
UmbracoLinqPadDriver copied to clipboard

Properties with the aliases that match keywords fail

Open drpeck opened this issue 9 years ago • 3 comments
trafficstars

One of my content type property aliases is called 'abstract'. While potentially short sighted this makes sense from an article perspective but as you're using the alias when building the POCOs I'm getting an error when trying to connect to my website path. Exception - Cannot compile typed context: Member modifier 'abstract' must precede the member type and name

I can see where to escape the member name in your solution but I've no idea where I'll then have to unescape it.

No worries about fixing this for me, as I'll take another approach, but I thought I'd log the issue.

drpeck avatar Jun 20 '16 10:06 drpeck

Cool, thx for logging it. I haven't used this codebase for a while now so if you can point me to where you'd escape and can see if it'd be easy to fix everywhere.

Shazwazza avatar Jun 20 '16 10:06 Shazwazza

While I was going to escape it in UmbracoLinqPad.Gateway.Compilers.ContentItemsCompiler.BuildClass() on line 51

Initially I was hackily just going to skip those values: if (new[] { "abstract", "public", "protected", "internal", "private", "sealed", "virtual" }.Any(s => s == property)) continue; but prefixing it with 3 underscores might be better

drpeck avatar Jun 20 '16 10:06 drpeck

Argh... brain not working on a Monday after #cg16 clearly. I'm sure you already realised but prefixing it like @abstract would probably sort it.

drpeck avatar Jun 20 '16 12:06 drpeck