public interface IOperationResult
{
bool IsSuccessful { get; set; }
public string Message { get; set; }
}
public interface ICreateCommandOperationResult<T?> : IOperationResult
{
public T? InsertedId { get; set; }
}
When I insert a record in database, I want to return inserted record's Id.
But sometimes there are exceptions that in this case I need to send null in InsertedId.
How can I do it?
ICreateCommandOperationResultgeneric onT(i.e.,ICreateCommandOperationResult<T>), constrainTto astructand then useT?as the type ofInsertedId