Refactor error handling and IHttpContextAccessor usage

Simplified error message construction in RoleApplication.cs by
removing redundant properties. Refactored IHttpContextAccessor
registration in Program.cs to use the service provider after
app initialization. Removed redundant no-op code in
NullFaceEmbeddingNotificationService.cs.
This commit is contained in:
2025-11-27 12:45:18 +03:30
parent 3526fdbf2f
commit 8fc798746f
3 changed files with 8 additions and 8 deletions

View File

@@ -27,4 +27,3 @@ public class NullFaceEmbeddingNotificationService : IFaceEmbeddingNotificationSe
return Task.CompletedTask;
}
}

View File

@@ -58,7 +58,7 @@ public class RoleApplication : IRoleApplication
{
_unitOfWork.RollbackAccountContext();
return operation.Failed("ارتباط با اپلیکیش پروگرام منیجر برقرار نشد"+response.Result.errorMessage +response.Result.ErrorType + response.Error);
return operation.Failed("ارتباط با اپلیکیش پروگرام منیجر برقرار نشد"+ response.Error);
}
if (!response.Result.isSuccess)

View File

@@ -331,15 +331,16 @@ builder.Services.AddParbad().ConfigureGateways(gateways =>
storage.UseMemoryCache();
});
#region GetHttpContext
var httpContextAccessor = new HttpContextAccessor();
builder.Services.AddSingleton<IHttpContextAccessor>(httpContextAccessor);
#endregion
var app = builder.Build();
#region GetHttpContext
var httpContextAccessor = app.Services.GetRequiredService<IHttpContextAccessor>();
#endregion
app.UseCors("AllowSpecificOrigins");
#region InternalProgarmManagerApi