Skip to content

Releases: BoomDAO/ICP.NET

4.0.0 Improved Custom Types and Generation

12 Oct 22:42
7b51d78
Compare
Choose a tag to compare

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

Full Changelog: 3.2.2...4.0.0

4.0.0-pre.9 Fixing null variant option bug

10 Oct 16:04
17f6354
Compare
Choose a tag to compare

What's Changed

Full Changelog: 4.0.0-pre.8...4.0.0-pre.9

4.0.0-pre.10 Misc bug fixes

10 Oct 17:49
932eb43
Compare
Choose a tag to compare
Pre-release

What's Changed

Full Changelog: 4.0.0-pre.9...4.0.0-pre.10

4.0.0-pre.8 Fixing noninline OptionalValue bug

09 Oct 23:44
c6eae59
Compare
Choose a tag to compare

What's Changed

  • Fixing optionalValue that arent inline mapping by @Gekctek in #109

Full Changelog: 4.0.0-pre.7...4.0.0-pre.8

4.0.0-pre.7 Fixing path bug

09 Oct 22:12
7025e86
Compare
Choose a tag to compare
Pre-release

What's Changed

Full Changelog: 4.0.0-pre.6...4.0.0-pre.7

4.0.0-pre.6 Variant OptionalOverride

09 Oct 20:56
a54bdd9
Compare
Choose a tag to compare
Pre-release

What's Changed

Full Changelog: 4.0.0-pre.4...4.0.0-pre.6

4.0.0-pre.5 Reverting nullable changes

08 Oct 22:28
9bb3b98
Compare
Choose a tag to compare
Pre-release

What's Changed

Full Changelog: 4.0.0-pre.4...4.0.0-pre.5

4.0.0-pre.4 Fixing nullable types

06 Oct 20:05
63b3799
Compare
Choose a tag to compare
Pre-release

What's Changed

Full Changelog: 4.0.0-pre.3...4.0.0-pre.4

4.0.0-pre.3 Null value fixes

05 Oct 21:15
49e06bf
Compare
Choose a tag to compare
Pre-release

What's Changed

Full Changelog: 4.0.0-pre.2...4.0.0-pre.3

4.0.0-pre.2 OptionalValue coercion

27 Sep 20:45
3e29c25
Compare
Choose a tag to compare
Pre-release

What's Changed

Full Changelog: 4.0.0-pre.1...4.0.0-pre.2