using System; namespace VCommon.VApplication { public interface IVSession { Guid? UserId { get; } Guid? TenantId { get; } string Token { get; } void DemandAuth(); public Guid GetUserId() { if (!UserId.HasValue) throw new VApplicationAuthException("Session.UserId is null! Probably, user is not logged in.", AuthReason.AuthRequired); return UserId.Value; } public Guid GetTenantId() { if (!TenantId.HasValue) throw new VApplicationAuthException("Session.TenantId is null! Possible problems: No user logged in or current logged in user in a host user (TenantId is always null for host users).", AuthReason.AuthRequired); return TenantId.Value; } } }