I'm trying to create an interface that will add a column to a database entity which will be used the track the user making changes.
public interface IAuditEntity<TKey>
{
TKey? UpdatedBy { get; set; }
}
The interface will be used by different applications. So 1 application could use an integer as a key and another might use a string.
However, as it's a nullable type I get the following error: A nullable type parameter must be known to be a value type or non-nullable reference type. Consider adding a 'class', 'struct', or type constraint.
How can I achieve this so I can use both value and reference types? So int or string really?
Thanks.