| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- using Abp.Domain.Entities;
- using Abp.Domain.Entities.Auditing;
- using Abp.MultiTenancy;
- using Abp.Runtime.Security;
- namespace IwbZero.MultiTenancy
- {
- /// <summary>
- /// Base class for tenants.
- /// </summary>
- [Table("Sys_Tenants")]
- [MultiTenancySide(MultiTenancySides.Host)]
- public abstract class TenantBase : FullAuditedEntity<int>, IPassivable
- {
- /// <summary>
- /// Max length of the <see cref="TenancyName"/> property.
- /// </summary>
- public const int MaxTenancyNameLength = 64;
- /// <summary>
- /// Max length of the <see cref="ConnectionString"/> property.
- /// </summary>
- public const int MaxConnectionStringLength = 1024;
- /// <summary>
- /// "Default".
- /// </summary>
- public const string DefaultTenantName = "Iwb";
- /// <summary>
- /// "^[a-zA-Z][a-zA-Z0-9_-]{1,}$".
- /// </summary>
- public const string TenancyNameRegex = "^[a-zA-Z][a-zA-Z0-9_-]{1,}$";
- /// <summary>
- /// Max length of the <see cref="Name"/> property.
- /// </summary>
- public const int MaxNameLength = 128;
- /// <summary>
- /// Tenancy name. This property is the UNIQUE name of this Tenant.
- /// It can be used as subdomain name in a web application.
- /// </summary>
- [Required]
- [StringLength(MaxTenancyNameLength)]
- public virtual string TenancyName { get; set; }
- /// <summary>
- /// Display name of the Tenant.
- /// </summary>
- [Required]
- [StringLength(MaxNameLength)]
- public virtual string Name { get; set; }
- /// <summary>
- /// ENCRYPTED connection string of the tenant database.
- /// Can be null if this tenant is stored in host database.
- /// Use <see cref="SimpleStringCipher"/> to encrypt/decrypt this.
- /// </summary>
- [StringLength(MaxConnectionStringLength)]
- public virtual string ConnectionString { get; set; }
- /// <summary>
- /// Is this tenant active?
- /// If as tenant is not active, no user of this tenant can use the application.
- /// </summary>
- public virtual bool IsActive { get; set; }
- }
- }
|