Open Moo-Juice opened 6 days ago
Yes, this is supported in the latest version 🙂
Hi there, it appears I am using the latest version. When I add the handle, I get 2 errors. This is the relevant generated section:
And the two errors:
error CS0101: The namespace 'Jigsaw.Memory' already contains a definition for 'Factory'
error CS0416: 'Jigsaw.Memory.Factory<T>.Handle.HandleTypeConverter': an attribute argument cannot use type parameters
I am probably doing something obviously wrong. Thanks for you assistance! :)
Oh, and the original source:
Ah, add partial
to your Factory<T>
type 🙂
Thanks for your prompt response, but I still had this issue :)
[System.ComponentModel.TypeConverter(typeof(HandleTypeConverter))]
error CS0416: 'Jigsaw.Memory.Factory<T>.Handle.HandleTypeConverter': an attribute argument cannot use type parameters
Hope you're well :)
Yeah unfortunately, that's not valid c# to use that attribute, because the attribute is defined as a nested type, which means the full name has a generic type parameter in it, and you can't use that. Your only options are to remove the attribute or to not nest it in the generic unfortunately
Ok, understood! Do I need to remove it from the generated file, or is there an option I can use to to have it removed as part of the source generation? Have a good day :)
Unfortunately you will need to use a custom template to remove the attribute from the generated code. You can read about how to use the codefix provider to create a custom template in the README and you can read more about what you can do with them here. Hope that helps!
Really like this library and have began integrating it in to my engine. However, there's a part of my project I cannot use this library easily, and that's where the strongly typed Id could be used as a nested class.
Essentially, what i want to do is this:
Is this sort of thing possible? If I need to make
Factory<T>
partial also, I'd not be against it.