Exemplo n.º 1
0
 /// <summary>
 /// Gets multi-tenancy side (<see cref="MultiTenancySides"/>) of an object that implements <see cref="IMayHaveTenant"/>.
 /// </summary>
 /// <param name="obj">The object</param>
 public static MultiTenancySides GetMultiTenancySide <TTenantId>(this IMayHaveTenant <TTenantId> obj)
     where TTenantId : struct
 {
     return(obj.TenantId.HasValue
         ? MultiTenancySides.Tenant
         : MultiTenancySides.Host);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Gets multi-tenancy side (<see cref="MultiTenancySides"/>) of an object that implements <see cref="IMayHaveTenant"/>.
 /// </summary>
 /// <param name="obj">The object</param>
 public static MultiTenancySides GetMultiTenancySide(this IMayHaveTenant obj)
 {
     return(obj.TenantId.HasValue
         ? MultiTenancySides.Tenant
         : MultiTenancySides.Host);
 }
Exemplo n.º 3
0
        public static void SetTenantIdOrThrow <T>(this IMayHaveTenant entity, ResolveFieldContext <T> context)
        {
            var userContext = context.GetUserContext();

            entity.TenantId = userContext.TenantId;
        }