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