Immutable Service Options
I have a service which mutates its options. I discovered that IOptions<T> creates a singleton and all of the unit tests I'm running all get the same options but unrelated services are mutating the options and other services are seeing those changes.
I'd like to have a simple solution that would ensure the options are not mutated and should something try to, it breaks or doesn't compile or whatever.
If there's a simple solution, what is it?
Someone in the chat yesterday mentioned something about IImmutable, but I don't know the specifics.
I saw something about an ImmutableDictionary, but I'd like the whole class to be.
Ideas?
I kind of think this should be a standard of some sort.
I'd like to have a simple solution that would ensure the options are not mutated and should something try to, it breaks or doesn't compile or whatever.
If there's a simple solution, what is it?
Someone in the chat yesterday mentioned something about IImmutable, but I don't know the specifics.
I saw something about an ImmutableDictionary, but I'd like the whole class to be.
Ideas?
I kind of think this should be a standard of some sort.