Search code examples
c#entity-frameworkunity-game-engineauto-generateef-power-tools

How to generate model from MS SQL with fields and NOT properties. Using EF


I'm using (EF Core power tools -> Reverse enginiring) to generate classes from MS SQL database.

It generates properties like:

public string Password { get; set; }
public string PositionId { get; set; }

But I need it to be fields like:

public string Password;
public string PositionId;

Is there a way to do so? Will it affect the data manipulating ways?

I need it to be fields becouse Unity's JSONUtility only work with fields and not properties. And since my model should be the same at the server and at the client.


Solution

  • So yeah. I looked at the problem in the wrong angle.

    Using Newtonsoft.Json instead of the Unity's JsonUtility solve the problem.