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?
ICreateCommandOperationResult
generic onT
(i.e.,ICreateCommandOperationResult<T>
), constrainT
to astruct
and then useT?
as the type ofInsertedId