AbstractService.cs 1.2 KB

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