| 12345678910111213141516171819202122232425262728293031 |
- using System.Security.Principal;
- using Quadarax.Foundation.Core.Data.Interface.Domain;
- namespace Quadarax.Application.QLiberace.Common.Domain
- {
- public class QlbrcContext : IContext
- {
- public IPrincipal CurrentUser { get; }
- public string? TenantCode { get; }
- public long? TenantId { get; }
- public QlbrcContext(IPrincipal? currentUser, string? tenantCode, long? tenantId)
- {
- if (currentUser == null)
- {
- var genericIdentity = new GenericIdentity("genericIdentity");
- currentUser = new GenericPrincipal(genericIdentity, Array.Empty<string>());
- }
- CurrentUser = currentUser;
- TenantCode = tenantCode;
- TenantId = tenantId;
- }
- public TContext GetContext<TContext>() where TContext : IContext
- {
- return (TContext)(IContext)this;
- }
- }
- }
|