Improve handling of stored procedure return value type
Check if return value is already a long before parsing its string representation. This enhances robustness and efficiency when the value is of the correct type.
This commit is contained in:
@@ -156,7 +156,9 @@ public class InsertObjectProcedureHandler(IRepository repo) : IRequestHandler<In
|
||||
var guidParam = parameters.Last();
|
||||
|
||||
if (guidParam.Value != DBNull.Value)
|
||||
if (long.TryParse(guidParam.Value.ToString(), out var guid))
|
||||
if (guidParam.Value is long longValue)
|
||||
return longValue;
|
||||
else if (long.TryParse(guidParam.Value.ToString(), out var guid))
|
||||
return guid;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user