Exporting structs

It looks like struct’s are not being exported from /types. I have a class where one of it’s properties is a struct and when I add servicestack reference it missed the struct so wont compile.

// exported as expected, cracking!
public class Wallace {
   public bool Wensleydale { get; set; }
   public bool CupOfTea { get; set; }
   public Grommit Grommit { get; set; } // <-- compiler error

// elusive like a were-rabbit, not exported
public struct Grommit {

Struct’s aren’t supported in all serializers and have special semantics in ServiceStack.Text Serializers which are not supported it the multiple languages Add ServiceStack Reference supports who only understands how to serializer DTO Types.

I can change to emit them as strings in the DTO’s which can transparently work when using ServiceStack.Text serializers although your structs will need to have a string constructor that can accept the same string as struct.ToString() to restore itself.

1 Like

thanks, missed that one. TBH in this case, I changed the struct to a class, problem solved, so its not something I think is needed.