kiota icon indicating copy to clipboard operation
kiota copied to clipboard

C# models could be records

Open marcinjahn opened this issue 8 months ago • 2 comments

The models generated by Kiota for the Csharp lang are currently classes. Making them records would enable the usage of with among various benefits.

Would is be reasonable to do so?

marcinjahn avatar Oct 06 '23 09:10 marcinjahn

Thanks for reaching out regarding this. The reason why we're not using records today is because the code kiota projects is netstandard2.0 so it supports the dotnet framework (4.X). There are a number of benefits we could unblock by switching to a netcore only support in the generated code, records as you outlined, but also the removal of a lot of conditional compilation and more. However changing this now would represent a breaking change, and require a new major version for kiota. It's unlikely we're going to be doing this now.

baywet avatar Oct 06 '23 12:10 baywet

You should split your generators and have two projects: CSharp.Legacy and CSharp.Modern

ImoutoChan avatar Dec 09 '23 13:12 ImoutoChan