You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow extending genericInterfaceImplementations of DefaultObjectFactory #982
changed the title [-]Allow to specify genericInterfaceImplementations for DefaultObjectFactory[/-][+]Allow extending genericInterfaceImplementations of DefaultObjectFactory[/+]on Sep 25, 2024
How are you wanting to extend that class? If you're wanting to add additional types you can do that by passing in a dictionary of type mappings. That linked method is just making sure the types are assignable and making a copy of the passed in dictionary. We could remove the sealed part of the class so you could extend it, that wouldn't be hard at all.
Moreover, I realized that in my case extending defaultGenericInterfaceImplementations does not help, I need to create an INodeTypeResolver (as suggested here #236 (comment)).
But for mapping-like collections, I also need to tweak the serialization (mentioned here #236 (comment)). Currently, I do the following:
Since I cannot currently derive from DefaultObjectFactory.
Removing sealed from DefaultObjectFactory will also help in this case, I would be able to derive from DefaultObjectFactory instead of ObjectFactoryBase.
Activity
[-]Allow to specify genericInterfaceImplementations for DefaultObjectFactory[/-][+]Allow extending genericInterfaceImplementations of DefaultObjectFactory[/+]EdwardCooke commentedon Sep 25, 2024
How are you wanting to extend that class? If you're wanting to add additional types you can do that by passing in a dictionary of type mappings. That linked method is just making sure the types are assignable and making a copy of the passed in dictionary. We could remove the
sealedpart of the class so you could extend it, that wouldn't be hard at all.n9 commentedon Sep 26, 2024
Yes, that will be sufficient.
Moreover, I realized that in my case extending
defaultGenericInterfaceImplementationsdoes not help, I need to create an INodeTypeResolver (as suggested here #236 (comment)).But for mapping-like collections, I also need to tweak the serialization (mentioned here #236 (comment)). Currently, I do the following:
Where
CustomObjectFactoryForSerializationis this:Since I cannot currently derive from
DefaultObjectFactory.Removing
sealedfromDefaultObjectFactorywill also help in this case, I would be able to derive fromDefaultObjectFactoryinstead ofObjectFactoryBase.EdwardCooke commentedon Sep 26, 2024
Sounds good, it'll be done.
Remove sealed from DefaultObjectFactory