warriordog / ActivityPubSharp

Modular implementation of ActivityPub in C#
https://warriordog.github.io/ActivityPubSharp/
Mozilla Public License 2.0
45 stars 9 forks source link

Make JsonLdSerializer injectable #156

Closed jenniferplusplus closed 8 months ago

jenniferplusplus commented 8 months ago

DI requires both public types and public constructors. And CSharp doesn't like it when constructors (maybe any function?) take arguments with types that are less visible than the constructor is. This was a bit of a problem, thanks to the pivot classes, which do actually seem like internal implementation details.

Rather than just make everything public, I moved the the internal pivot classes to be internal and defined within TypeMapConverter, which is the only place they're ever used. TypeMapConverter now just constructs them directly. If needed, they can still be replaced by DI provided implementations, via the long constructor.