Releases: BoomDAO/ICP.NET
Releases · BoomDAO/ICP.NET
4.0.0 Improved Custom Types and Generation
BREAKING CHANGES:
3.x.x => 4.x.x
The big change here was around variant classes and their attributes. Before the option types were defined by the attribute on each enum member, but in 4.x.x it changed to using method return types and having not type information in attributes. Also the VariantAttribute now gets the enum type from the Tag property vs the attribute
Version 3
[Variant(typeof(MyVariantTag))] // Required to flag as variant and define options with enum
public class MyVariant
{
[VariantTagProperty] // Flag for tag/enum property, not required if name is `Tag`
public MyVariantTag Tag { get; set; }
[VariantValueProperty] // Flag for value property, not required if name is `Value`
public object? Value { get; set; }
}
public enum MyVariantTag
{
[CandidName("o1")] // Used to override name for candid
Option1,
[CandidName("o2")]
[VariantType(typeof(string))] // Used to specify if the option has a value associated
Option2
}
Version 4
[Variant] // Required to flag as variant
public class MyVariant
{
[VariantTagProperty] // Flag for tag/enum property, not required if name is `Tag`
public MyVariantTag Tag { get; set; }
[VariantValueProperty] // Flag for value property, not required if name is `Value`
public object? Value { get; set; }
// This method is used to specify if the option has a type/value associated
[VariantOption("o2")] // Specify the candid tag if different than 'As{CandidTag}' like 'Option2' here
public string AsOption2()
{
return (string)this.Value!;
}
}
public enum MyVariantTag
{
[CandidName("o1")] // Used to override name for candid
Option1,
[CandidName("o2")]
Option2
}
What's Changed
- Variants with properties by @Gekctek in #98
- Docs by @Gekctek in #99
- Making a change for composite query functions by @Gekctek in #100
- Optional value alternative by @Gekctek in #101
- Update README.md by @Gekctek in #102
- Adding fixes for null values by @Gekctek in #103
- Update README.md by @Gekctek in #104
- Nullable fixes by @Gekctek in #105
- Reverting and adding [CandidOptional] by @Gekctek in #106
- Adding variant optional and client gen optionals by @Gekctek in #107
- Fixing relative paths by @Gekctek in #108
- Fixing optionalValue that arent inline mapping by @Gekctek in #109
- Fixing null variant options by @Gekctek in #110
- Updating Docs by @Gekctek in #111
- Misc bugs by @Gekctek in #112
- Adding breaking changes guide by @Gekctek in #113
Full Changelog: 3.2.2...4.0.0
4.0.0-pre.9 Fixing null variant option bug
What's Changed
Full Changelog: 4.0.0-pre.8...4.0.0-pre.9
4.0.0-pre.10 Misc bug fixes
What's Changed
Full Changelog: 4.0.0-pre.9...4.0.0-pre.10
4.0.0-pre.8 Fixing noninline OptionalValue bug
What's Changed
Full Changelog: 4.0.0-pre.7...4.0.0-pre.8
4.0.0-pre.7 Fixing path bug
4.0.0-pre.6 Variant OptionalOverride
What's Changed
Full Changelog: 4.0.0-pre.4...4.0.0-pre.6
4.0.0-pre.5 Reverting nullable changes
What's Changed
Full Changelog: 4.0.0-pre.4...4.0.0-pre.5
4.0.0-pre.4 Fixing nullable types
What's Changed
Full Changelog: 4.0.0-pre.3...4.0.0-pre.4
4.0.0-pre.3 Null value fixes
What's Changed
Full Changelog: 4.0.0-pre.2...4.0.0-pre.3