BoomDAO / ICP.NET

A library for .NET/C#/Unity to natively communicate with the Internet Computer (ICP)
MIT License
50 stars 3 forks source link

Custom type configuration for generation #89

Closed Gekctek closed 10 months ago

Gekctek commented 1 year ago

So was wondering the candid here could be exported like this easily,

Instead of being exported as public class ItemService { public List dictionary {get; set; } }

We have a lot of hash maps on the backend, and would like to keep them that way And we lose the middle object in the data.

Gekctek — Today at 11:07 AM hmmm. Im sure its possible, but i think I need to come up with a good system for auto mapping to certain types Like in this scenario it looks like you want to take a vec record and make it a dictionary with a key of the name field. That would require configuration that is specific to that one class/property. A thing i was thinking about was maybe if we could modify the .did file itself to add config, but there is an issue with regenerating the .did file So maybe we can do a configuration 'by name' where we could have a seperate file that is specific for code generation that would specify a type like Items_Dictionary and say we want it to be a dictionary with a key of name

Gekctek commented 10 months ago

Done via defaults/client generation options. Will treat dictionaries as vec rec {t1;t2;}