We have a class, say LegacyUserSettingsService. LegacyUserSettingsService implements an interface, IUserSettingsService.
You can get an instance of the IUserSettingsService by calling our ApplicationServicesFactory. The factory uses Spring.NET to construct the concrete LegacyUserSettingsService.
The trouble is that new developers sometimes do their own thing and construct new instances of the LegacyUserSettingsService directly (instead of going via the factory).
Is there a way to protect the constructor of the concrete class so it can only be called from the factory? A well-known pattern perhaps?
Note that the concrete class resides in a different assembly (separate from the Factory's assembly, so the internal keyword is not a solution). The factory assembly references the other assembly that contains the concrete class.
Any ideas?