AbstractService.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Security.Principal;
  3. using Microsoft.Extensions.Logging;
  4. using Quadarax.Foundation.Core.Business.Interface;
  5. using Quadarax.Foundation.Core.Data.Interface.Entity;
  6. using Quadarax.Foundation.Core.Data.Interface.Entity.Dto;
  7. namespace Quadarax.Foundation.Core.Business
  8. {
  9. public abstract class AbstractService : IService
  10. {
  11. #region *** Properties ***
  12. protected ILogger<AbstractService> Log { get; }
  13. protected IPrincipal CurrentPrincipal { get; }
  14. #endregion
  15. #region *** Constructors ***
  16. protected AbstractService(IPrincipal currentPrincipal, ILoggerFactory logger)
  17. {
  18. Log = logger.CreateLogger<AbstractService>();
  19. if (currentPrincipal == null)
  20. {
  21. var genericIdentity = new GenericIdentity("genericIdentity");
  22. currentPrincipal = new GenericPrincipal(genericIdentity, new string[] {});
  23. }
  24. CurrentPrincipal = currentPrincipal;
  25. Log.LogTrace($"Service '{GetType().Name}' [Hash:{GetHashCode()}] initialized.");
  26. }
  27. #endregion
  28. #region *** Public Operations ***
  29. public IResult Test()
  30. {
  31. return new ResultPlain();
  32. }
  33. #endregion
  34. }
  35. }