AbstractService.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Security.Principal;
  2. using Quadarax.Foundation.Core.Business.Interface;
  3. using Quadarax.Foundation.Core.Data;
  4. using Quadarax.Foundation.Core.Data.Interface.Entity;
  5. using Quadarax.Foundation.Core.Data.Interface.Entity.Dto;
  6. using Quadarax.Foundation.Core.Logging;
  7. namespace Quadarax.Foundation.Core.Business
  8. {
  9. public abstract class AbstractService : IService
  10. {
  11. #region *** Properties ***
  12. protected ILog Log { get; }
  13. protected IPrincipal CurrentPrincipal { get; }
  14. #endregion
  15. #region *** Constructors ***
  16. protected AbstractService(IPrincipal currentPrincipal, ILogger logger)
  17. {
  18. Log = logger.GetLogger(typeof(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.Log(LogSeverityEnum.Trace, $"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. }