MSSQL database infers some fields with "_" underscore

Hi Radzen Team,

I have started on a new project and decided to use a Blazor Server side for it.
I'm using a MS SQL database, after adding the database and infering it to create some CRUD pages , the application does not run giving some info in the output window of Radzen.
It seems that some fields are generated with a "_" underscore in a class that has a relation to the table with the field "code" in it. e.g.

public string _code

dotnet: E:..l\server\Pages\xxxxx.razor(45,34): error CS1061: 'Cxxxf' does not contain a definition for 'code' and no accessible extension method 'code' accepting a first argument of type 'Cxxxxf' could be found (are you missing a using directive or an assembly reference?) [E:...l\server\Nxxxxl.csproj]

actual field in the database is without a "_" .

Indeed Radzen will rename certain field names named after reserved words however the rename should be handled in the templates. Is the page created from a template or manually?

Just the standard steps performed yet , so only connected to the database and generated the CRUD pages .
No manual or custom action done yet.

Did not know that "code" was a reserved word ?

Can you confirm if there is an issue ? The word "code" is not a reserved word in "MSSQL" but also not in C# if I'm not mistaken .

The rename action takes place in the Model and not in the template pages , therefor Radzen does not start , complaining about that "code" is not part of the model "CS1061" .
What to do now ?

You can safely rename the property in the meta of the page to the generated property name with underscore. We will review our templates to double check if all renamed properties are taken into account.

HI ,
It was easier to just change the model, perhaps "code" should not be listed in the reserved words for Radzen. It now compiles and runs out of the box without any changes.
It would however be great if the next update fixed this and I can safely remove the files now in the ignore list.

code is a reserved word in Blazor:

@code { }

Hi @korchev,

But Radzen generates the pages so that the application does not start, something is not going ok.

But, I have changed the model and reversed the renaming of the field and all works , so is it really necessary to have code in the reserved list for infering the database ?

Yes it is necessary however it was not implemented properly in the current version. We've fixed this and in the next update (later today) Radzen will generated the following model:

and bindings will use correct property name:

Good morning @enchev ,

I have just no luck at all :grinning:
I’ll test it and report when the update is available.

Thank you

Just to report back: issue is fixed and can be closed