DocSpace-buildtools/common/ASC.Core.Common/EF/Model/Tenant/DbTenant.cs

58 lines
1.9 KiB
C#
Raw Normal View History

2019-12-03 15:20:21 +00:00
using System;
using System.ComponentModel.DataAnnotations.Schema;
2020-04-27 16:59:52 +00:00
2019-12-03 15:20:21 +00:00
using ASC.Core.Tenants;
2020-04-27 16:59:52 +00:00
using Microsoft.EntityFrameworkCore;
2019-12-03 15:20:21 +00:00
namespace ASC.Core.Common.EF.Model
{
[Table("tenants_tenants")]
public class DbTenant
{
public int Id { get; set; }
public string Name { get; set; }
public string Alias { get; set; }
public string MappedDomain { get; set; }
public int Version { get; set; }
[Column("version_changed")]
public DateTime VersionChanged { get; set; }
public string Language { get; set; }
public string TimeZone { get; set; }
public string TrustedDomains { get; set; }
public TenantTrustedDomainsType TrustedDomainsEnabled { get; set; }
public TenantStatus Status { get; set; }
public DateTime StatusChanged { get; set; }
public DateTime CreationDateTime { get; set; }
[Column("owner_id")]
public Guid OwnerId { get; set; }
public bool Public { get; set; }
public string PublicVisibleProducts { get; set; }
[Column("payment_id")]
public string PaymentId { get; set; }
public TenantIndustry? Industry { get; set; }
[Column("last_modified")]
public DateTime LastModified { get; set; }
public bool Spam { get; set; }
public bool Calls { get; set; }
public DbTenantPartner Partner { get; set; }
}
2020-04-27 16:59:52 +00:00
public static class DbTenantExtension
{
public static void AddDbTenant(this ModelBuilder modelBuilder)
{
modelBuilder.Entity<DbTenant>()
.HasOne(r => r.Partner)
.WithOne(r => r.Tenant)
.HasForeignKey<DbTenantPartner>(r => new { r.TenantId })
.HasPrincipalKey<DbTenant>(r => new { r.Id });
}
}
2019-12-03 15:20:21 +00:00
}