I have a (public) interface, IAuditLogConfig
which has a property with a public getter and an internal setter:
public interface IAuditLogConfig
{
int ElementTypeId { get; internal set; }
// ...and other methods
}
Implementations of this interface are instantiated via a factory which is in the same library and which will set the ElementTypeId
property.
public IAuditLogConfig Create(int elementTypeId)
{
var key = ...;
var auditLogConfig = _auditLogConfigFactory.ComponentExists(key)
? _auditLogConfigFactory.CreateComponent(key)
: new GenericAuditLogConfig();
auditLogConfig.ElementTypeId = elementTypeId;
return auditLogConfig;
}
But how do I declare this property on the implementation classes?
Here's an example of the problem I have when declaring the setter on the GenericAuditLogConfig
class which is in the same library:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…