Json2CSharp / Json2CSharpCodeGenerator

Microsoft Reciprocal License
305 stars 83 forks source link

Add support for immutable C# classes #41

Closed daiplusplus closed 3 years ago

daiplusplus commented 3 years ago
Json2CSharp commented 3 years ago

Jehoel THANK YOU so much for your effort and contribution !! I will add an "Generate Immutable Classes " setting tommorow which will create the immutable class output. I will check to see if there's any conflict with other settings and just do a round of testing.

Is there a way I can buy you a cup of coffee for your hard work ??

daiplusplus commented 3 years ago

Phew! I was far more concerned you'd reject my PR for scope-creep and for introducing opinionated unrelated changes <_<

Json2CSharp commented 3 years ago

I had to reference the System.Data.Entity.Design.PluralizationServices cause for some reason my azure function (.Net Core 3.1) was throwing error with the System.Data.Entity.Design dll. not sure why

I had to also reference the newtonsoft dll cause It's throwing an error that It's not finding it.

Other than that I merged the changes and added a settings on the site. I will fix the download as zip files for this setting later (https://github.com/Json2CSharp/Json2CSharpCodeGenerator/issues/43)

Other than that thank you so much again for your contribution !!!

daiplusplus commented 3 years ago

@Json2CSharp Oh, I didn't know the code runs in a .NET Core platform. I saw the main project was a .NET Framework 4.6.1 project so I can see why you might have problems with NuGet. You should change the main library project to target .NET Standard 2.0 then.

There are a load of pluralization libraries available on NuGet that are probably better than EF's - I just chose the first one that used EF's without needing to reference EF or have a local copy.

You shouldn't be getting any errors about Newtonsoft.Json - did you do a "NuGet Package Restore" when you loaded the solution in VS? What version of VS are you using?

Json2CSharp commented 3 years ago

Im using vs 2019, I'll an issue for changing to nuget packages hopefully it will work