0
manojreddy created
I have some model classes.
public class AClass : FullAuditedEntity<int>
{
}
and one interface like below.
public interface ISomeInterface<T, TEntity> where T : BaseFileEntity where TEntity : class, IEntity<int>
{
}
Now If I add one extra model class like below.
public class BClass : FullAuditedEntity<string>
{
}
I have to define another interface for this change like below.
public interface ISomeInterface<T, TEntity> where T : BaseFileEntity where TEntity : class, IEntity<string>
{
}
So basically it's duplicate code. Is there any better way to do this?
1 Answer(s)
-
0
Hi,
You can define your interface something like this;
public interface ISomeInterface<T, TEntity, TPrimaryKey> where T : BaseFileEntity where TEntity : class, IEntity<TPrimaryKey> { }