using Microsoft.EntityFrameworkCore; using Quadarax.Foundation.Core.Data.Domain; #nullable disable namespace BO.AppServer.Data.Entity { public partial class BOContext : DataDomain { public BOContext(DbContextOptions options) : base(options) { } public virtual DbSet Artifacts { get; set; } public virtual DbSet BillingInfos { get; set; } public virtual DbSet BillingPlans { get; set; } public virtual DbSet Invoices { get; set; } public virtual DbSet InvoiceIssuers { get; set; } public virtual DbSet InvoiceItems { get; set; } public virtual DbSet Metadocuments { get; set; } public virtual DbSet MetadocumentBillings { get; set; } public virtual DbSet MetadocumentTags { get; set; } public virtual DbSet MimeTypes { get; set; } public virtual DbSet Registrations { get; set; } public virtual DbSet Statistics { get; set; } public virtual DbSet StatusHistories { get; set; } public virtual DbSet Structures { get; set; } public virtual DbSet Tags { get; set; } public virtual DbSet Users { get; set; } public virtual DbSet UserWorkspaces { get; set; } public virtual DbSet Workspaces { get; set; } public virtual DbSet WorkspaceBillings { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS"); modelBuilder.Entity(entity => { entity.ToTable("Artifact"); entity.HasComment("Stores single part of metadocument (called artifact). Refresents fingle physical file included for processing."); entity.Property(e => e.Id).HasComment("Primary key of artifact record"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when artifact was created (uploaded)"); entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) artifact"); entity.Property(e => e.Extension) .HasMaxLength(10) .HasComment("Artifact file extension"); entity.Property(e => e.Length).HasComment("Defines file content length in bytes"); entity.Property(e => e.MetadocumentId).HasComment("Reference to owning metadocument"); entity.Property(e => e.MimeTypeId).HasComment("Reference to MIME Type enumeration"); entity.Property(e => e.Name) .IsRequired() .HasMaxLength(200) .HasComment("Artifact file name without extension"); entity.Property(e => e.Type).HasComment("Defines type of artifact. 0 - Input, 1 - Output"); entity.HasOne(d => d.CreatedByUser) .WithMany(p => p.Artifacts) .HasForeignKey(d => d.CreatedByUserId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_Artifact_User_Created"); entity.HasOne(d => d.Metadocument) .WithMany(p => p.Artifacts) .HasForeignKey(d => d.MetadocumentId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_Artifact_Metadocument"); entity.HasOne(d => d.MimeType) .WithMany(p => p.Artifacts) .HasForeignKey(d => d.MimeTypeId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_Artifact_MimeType"); }); modelBuilder.Entity(entity => { entity.ToTable("BillingInfo"); entity.HasComment("Workspace billing information for invoicing"); entity.Property(e => e.Id).HasComment("Primary key of billing information record"); entity.Property(e => e.Address1) .IsRequired() .HasMaxLength(200) .HasComment("Billing Address line 1"); entity.Property(e => e.Address2) .HasMaxLength(200) .HasComment("Billing Address line 2"); entity.Property(e => e.City) .IsRequired() .HasMaxLength(100) .HasComment("Billing Address city"); entity.Property(e => e.Country) .IsRequired() .HasMaxLength(50) .HasComment("Billing Address country"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when billing info was created"); entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info"); entity.Property(e => e.Email) .IsRequired() .HasMaxLength(20) .HasComment("Billing email"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when billing info was modified"); entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info"); entity.Property(e => e.Phone) .HasMaxLength(20) .HasComment("Billing phone with format +XXXXXXXXX"); entity.Property(e => e.SubjectName) .IsRequired() .HasMaxLength(200) .HasComment("Billing Subject name"); entity.Property(e => e.TaxNumber) .IsRequired() .HasMaxLength(20) .HasComment("Billing Tax number"); entity.Property(e => e.Vatnumber) .HasMaxLength(20) .HasColumnName("VATNumber") .HasComment("Billing VAT number"); entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace"); entity.Property(e => e.Zip) .IsRequired() .HasMaxLength(20) .HasColumnName("ZIP") .HasComment("Billing Address ZIP"); entity.HasOne(d => d.CreatedByUser) .WithMany(p => p.BillingInfoCreatedByUsers) .HasForeignKey(d => d.CreatedByUserId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_BillingInfo_User_Created"); entity.HasOne(d => d.ModifiedByUser) .WithMany(p => p.BillingInfoModifiedByUsers) .HasForeignKey(d => d.ModifiedByUserId) .HasConstraintName("REL_BillingInfo_User_Modified"); //entity.HasOne(d => d.Workspace) // .WithMany(p => p.BillingInfos) // .HasForeignKey(d => d.WorkspaceId) // .OnDelete(DeleteBehavior.ClientSetNull) // .HasConstraintName("REL_BillingInfo_Workspace"); }); modelBuilder.Entity(entity => { entity.ToTable("BillingPlan"); entity.HasComment("Defines global Billing plan strategies (how to bill document processing in workspace). This table is managed only with administrator."); entity.Property(e => e.Id).HasComment("Primary key of BillingPlan record"); entity.Property(e => e.Code) .IsRequired() .HasMaxLength(10) .HasComment("Billing plan short code"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when metadocument was created (uploaded)"); entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) metadocument"); entity.Property(e => e.Currency) .IsRequired() .HasMaxLength(3) .IsUnicode(false) .HasComment("Billing plan price currency"); entity.Property(e => e.Description) .IsRequired() .HasMaxLength(200) .HasComment("Billing plan short description"); entity.Property(e => e.IsCustom).HasComment("Flag if billing plan is custom dependent"); entity.Property(e => e.IsEnabled).HasComment("Flag if record is active, otherwise shuld be delete"); entity.Property(e => e.IsHidden).HasComment("Flag if billing plan is private for use, only SuperAdmin can use it"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when metadocument was modified"); entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated metadocument"); entity.Property(e => e.Name) .IsRequired() .HasMaxLength(200) .HasComment("Billing plan name"); entity.Property(e => e.Price) .HasColumnType("decimal(18, 0)") .HasComment("Billing plan price"); entity.Property(e => e.PstcreditsPerItem) .HasColumnName("PSTCreditsPerItem") .HasComment("Preset - single item credit cost"); entity.Property(e => e.PstinitialCredits) .HasColumnName("PSTInitialCredits") .HasComment("Preset - initial credit amount"); entity.Property(e => e.PstprocessProfile) .HasMaxLength(5) .IsUnicode(false) .HasColumnName("PSTProcessProfile") .HasComment("Preset - processing profile code"); entity.Property(e => e.Pstquality) .HasColumnName("PSTQuality") .HasComment("Preset - process quality 0 = lowest"); entity.Property(e => e.Psttest) .HasColumnName("PSTTest") .HasComment("Preset - testing mode"); entity.Property(e => e.Pstwatermark) .HasColumnName("PSTWatermark") .HasComment("Preset - watermarked"); entity.HasOne(d => d.CreatedByUser) .WithMany(p => p.BillingPlanCreatedByUsers) .HasForeignKey(d => d.CreatedByUserId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_BillingPlan_User_Created"); entity.HasOne(d => d.ModifiedByUser) .WithMany(p => p.BillingPlanModifiedByUsers) .HasForeignKey(d => d.ModifiedByUserId) .HasConstraintName("REL_BillingPlan_User_Modified"); }); modelBuilder.Entity(entity => { entity.ToTable("Invoice"); entity.HasComment("Stores invoice information of Workspace BusinessPlan "); entity.Property(e => e.Id).HasComment("Primary key of invoice record"); entity.Property(e => e.Address1) .IsRequired() .HasMaxLength(200) .HasComment("Billing Address line 1"); entity.Property(e => e.Address2) .HasMaxLength(200) .HasComment("Billing Address line 2"); entity.Property(e => e.Channel) .IsRequired() .HasMaxLength(20) .HasComment("Pay channel"); entity.Property(e => e.ChannelReference) .IsRequired() .HasMaxLength(50) .HasComment("Pay channel reference (account number)"); entity.Property(e => e.City) .IsRequired() .HasMaxLength(100) .HasComment("Billing Address city"); entity.Property(e => e.Code) .IsRequired() .HasMaxLength(12) .IsUnicode(false) .HasComment("Invoice number"); entity.Property(e => e.Country) .IsRequired() .HasMaxLength(50) .HasComment("Billing Address country"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when billing info was created"); entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info"); entity.Property(e => e.DueDate) .HasColumnType("datetime") .HasComment("Due date"); entity.Property(e => e.Email) .IsRequired() .HasMaxLength(20) .HasComment("Billing email"); entity.Property(e => e.InvoiceIssuerId).HasComment("Reference to invoice issuer record"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when billing info was modified"); entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info"); entity.Property(e => e.Phone) .HasMaxLength(20) .HasComment("Billing phone with format +XXXXXXXXX"); entity.Property(e => e.SubjectName) .IsRequired() .HasMaxLength(200) .HasComment("Billing Subject name"); entity.Property(e => e.TaxDate) .HasColumnType("datetime") .HasComment("Tax date"); entity.Property(e => e.TaxNumber) .IsRequired() .HasMaxLength(20) .HasComment("Billing Tax number"); entity.Property(e => e.TotalBaseCurrency) .IsRequired() .HasMaxLength(3) .IsUnicode(false) .HasComment("Total base price currency (w/o VAT)"); entity.Property(e => e.TotalBasePrice) .HasColumnType("decimal(16, 4)") .HasComment("Total base price (w/o VAT)"); entity.Property(e => e.Vatnumber) .HasMaxLength(20) .HasColumnName("VATNumber") .HasComment("Billing VAT number"); entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace"); entity.Property(e => e.Zip) .IsRequired() .HasMaxLength(20) .HasColumnName("ZIP") .HasComment("Billing Address ZIP"); entity.HasOne(d => d.CreatedByUser) .WithMany(p => p.InvoiceCreatedByUsers) .HasForeignKey(d => d.CreatedByUserId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_Invoice_User_Created"); entity.HasOne(d => d.InvoiceIssuer) .WithMany(p => p.Invoices) .HasForeignKey(d => d.InvoiceIssuerId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_Invoice_InvoiceIssuer"); entity.HasOne(d => d.ModifiedByUser) .WithMany(p => p.InvoiceModifiedByUsers) .HasForeignKey(d => d.ModifiedByUserId) .HasConstraintName("REL_Invoice_User_Modified"); entity.HasOne(d => d.Workspace) .WithMany(p => p.Invoices) .HasForeignKey(d => d.WorkspaceId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_Invoice_Workspace"); }); modelBuilder.Entity(entity => { entity.ToTable("InvoiceIssuer"); entity.HasComment("Defines information about Invoice Issuer and its contacts information (used in invoice header)"); entity.Property(e => e.Id).HasComment("Primary key of invoice issuer record"); entity.Property(e => e.Address1) .IsRequired() .HasMaxLength(200) .HasComment("Billing Address line 1"); entity.Property(e => e.Address2) .HasMaxLength(200) .HasComment("Billing Address line 2"); entity.Property(e => e.City) .IsRequired() .HasMaxLength(100) .HasComment("Billing Address city"); entity.Property(e => e.Country) .IsRequired() .HasMaxLength(50) .HasComment("Billing Address country"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when billing info was created"); entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info"); entity.Property(e => e.Email) .IsRequired() .HasMaxLength(20) .HasComment("Billing email"); entity.Property(e => e.IsEnabled).HasComment("Flag if record is enabled"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when billing info was modified"); entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info"); entity.Property(e => e.Phone) .HasMaxLength(20) .HasComment("Billing phone with format +XXXXXXXXX"); entity.Property(e => e.SubjectName) .IsRequired() .HasMaxLength(200) .HasComment("Billing Subject name"); entity.Property(e => e.TaxNumber) .IsRequired() .HasMaxLength(20) .HasComment("Billing Tax number"); entity.Property(e => e.Vatnumber) .HasMaxLength(20) .HasColumnName("VATNumber") .HasComment("Billing VAT number"); entity.Property(e => e.Zip) .IsRequired() .HasMaxLength(20) .HasColumnName("ZIP") .HasComment("Billing Address ZIP"); entity.HasOne(d => d.CreatedByUser) .WithMany(p => p.InvoiceIssuerCreatedByUsers) .HasForeignKey(d => d.CreatedByUserId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_InvoiceIssuer_User_Created"); entity.HasOne(d => d.ModifiedByUser) .WithMany(p => p.InvoiceIssuerModifiedByUsers) .HasForeignKey(d => d.ModifiedByUserId) .HasConstraintName("REL_InvoiceIssuer_User_Modified"); }); modelBuilder.Entity(entity => { entity.ToTable("InvoiceItem"); entity.HasComment("Invoice item"); entity.Property(e => e.Id).HasComment("Primary key of invoice item record"); entity.Property(e => e.BillingPlanCode) .IsRequired() .HasMaxLength(10) .HasComment("Billing plan short code"); entity.Property(e => e.BillingPlanId).HasComment("Reference to billing plan"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when billing info was created"); entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info"); entity.Property(e => e.InvoiceId).HasComment("Reference to owning invoice"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when billing info was modified"); entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info"); entity.Property(e => e.UnitBaseCurrency) .IsRequired() .HasMaxLength(3) .IsUnicode(false) .HasComment("Unit base price currency (w/o VAT)"); entity.Property(e => e.UnitBasePrice) .HasColumnType("decimal(16, 4)") .HasComment("Unit base price (w/o VAT)"); entity.Property(e => e.UnitQuantity) .HasDefaultValueSql("((1))") .HasComment("Unit quantity"); entity.HasOne(d => d.BillingPlan) .WithMany(p => p.InvoiceItems) .HasForeignKey(d => d.BillingPlanId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_InvoiceItem_BillingPlan"); entity.HasOne(d => d.CreatedByUser) .WithMany(p => p.InvoiceItemCreatedByUsers) .HasForeignKey(d => d.CreatedByUserId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_InvoiceItem_User_Created"); entity.HasOne(d => d.Invoice) .WithMany(p => p.InvoiceItems) .HasForeignKey(d => d.InvoiceId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_InvoiceItem_Invoice"); entity.HasOne(d => d.ModifiedByUser) .WithMany(p => p.InvoiceItemModifiedByUsers) .HasForeignKey(d => d.ModifiedByUserId) .HasConstraintName("REL_InvoiceItem_User_Modified"); }); modelBuilder.Entity(entity => { entity.ToTable("Metadocument"); entity.HasComment("Abstract single document header to process. Has setting parameters for computing and status"); entity.Property(e => e.Id).HasComment("Primary key of metadocument record"); entity.Property(e => e.AffinityRegistrationId).HasComment("Reference to assigned ProcessServer process which currently working on document."); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when metadocument was created (uploaded)"); entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) metadocument"); entity.Property(e => e.LastDowloaded) .HasColumnType("datetime") .HasComment("Timestamp when metadocument was last downloaded"); entity.Property(e => e.LastDownloadedByUserId).HasComment("Reference to user who last metadocument dowloaded"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when metadocument was modified"); entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated metadocument"); entity.Property(e => e.Name) .IsRequired() .HasMaxLength(200) .HasComment("Metadocument name"); entity.Property(e => e.Status).HasComment("Metadocument status"); entity.Property(e => e.StructureId).HasComment("Reference to owning structure (workspace)"); entity.HasOne(d => d.AffinityRegistration) .WithMany(p => p.Metadocuments) .HasForeignKey(d => d.AffinityRegistrationId) .HasConstraintName("REL_Metadocument_Registration"); entity.HasOne(d => d.CreatedByUser) .WithMany(p => p.MetadocumentCreatedByUsers) .HasForeignKey(d => d.CreatedByUserId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_Metadocument_User_Created"); entity.HasOne(d => d.LastDownloadedByUser) .WithMany(p => p.MetadocumentLastDownloadedByUsers) .HasForeignKey(d => d.LastDownloadedByUserId) .HasConstraintName("REL_Metadocument_User_Downloaded"); entity.HasOne(d => d.ModifiedByUser) .WithMany(p => p.MetadocumentModifiedByUsers) .HasForeignKey(d => d.ModifiedByUserId) .HasConstraintName("REL_Metadocument_User_Modified"); entity.HasOne(d => d.Structure) .WithMany(p => p.Metadocuments) .HasForeignKey(d => d.StructureId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_Metadocument_Structure"); }); modelBuilder.Entity(entity => { entity.HasNoKey(); entity.ToTable("MetadocumentBilling"); entity.HasComment("Association of metadocument and billing plan with properties. Stores information about processed documents (name, status timestamps, etc.) relates to workspace billing plan selection."); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when billing was created"); entity.Property(e => e.CreditCost).HasComment("Numeric value of billing plan spending. Depends on BillingPlan."); entity.Property(e => e.Downloaded) .HasColumnType("datetime") .HasComment("Timestamp when document was last downloaded"); entity.Property(e => e.MetadocumentId).HasComment("Reference to owning metadocument"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when billing was modified"); entity.Property(e => e.Procesed) .HasColumnType("datetime") .HasComment("Timestamp when document was processed"); entity.Property(e => e.ProcessProfile) .HasMaxLength(5) .IsUnicode(false) .HasComment("Processing profile code"); entity.Property(e => e.ProcessStart) .HasColumnType("datetime") .HasComment("Timestamp when document set to processing state"); entity.Property(e => e.ProcessState).HasComment("Last state of processing (OK,Fail)"); entity.Property(e => e.Psinstance) .HasMaxLength(100) .IsUnicode(false) .HasColumnName("PSInstance") .HasComment("Process server instance identifier"); entity.Property(e => e.Quality).HasComment("Process quality 0 = lowest"); entity.Property(e => e.Test).HasComment("Flag if testing mode"); entity.Property(e => e.Watermark).HasComment("Flag if watermarked"); entity.Property(e => e.WorkspaceBillingId).HasComment("Reference to workspace billing plan"); entity.HasOne(d => d.Metadocument) .WithMany() .HasForeignKey(d => d.MetadocumentId) .HasConstraintName("REL_MetadocumentBilling_Metadocument"); entity.HasOne(d => d.WorkspaceBilling) .WithMany() .HasForeignKey(d => d.WorkspaceBillingId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_MetadocumentBilling_WorkspaceBilling"); }); modelBuilder.Entity(entity => { entity.HasNoKey(); entity.ToTable("MetadocumentTag"); entity.HasComment("Association of metadocument and tag"); entity.Property(e => e.MetadocumentId).HasComment("Reference to owning metadocument"); entity.Property(e => e.TagId).HasComment("Reference to Tag"); entity.HasOne(d => d.Metadocument) .WithMany() .HasForeignKey(d => d.MetadocumentId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_MetadocumentTag_Metadocument"); entity.HasOne(d => d.Tag) .WithMany() .HasForeignKey(d => d.TagId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_MetadocumentTag_Tag"); }); modelBuilder.Entity(entity => { entity.ToTable("MimeType"); entity.HasComment("MIME Types global enumeration. Defines file extension and MIME type association, This table is managed only with administrator."); entity.Property(e => e.Id).HasComment("Primary key of MIMEType record"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when metadocument was created (uploaded)"); entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) metadocument"); entity.Property(e => e.Description) .IsRequired() .HasMaxLength(200) .HasComment("Short description of MIMEType"); entity.Property(e => e.Extensions) .IsRequired() .HasMaxLength(500) .HasComment("Extensions for mime type separated by semicolomn (example cad; cat; txt)"); entity.Property(e => e.IsEnabled).HasComment("Flag if record is active, otherwise shuld be delete"); entity.Property(e => e.Mimetype1) .IsRequired() .HasMaxLength(500) .HasColumnName("MIMEType") .HasComment("MIMEType code"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when metadocument was modified"); entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated metadocument"); entity.HasOne(d => d.CreatedByUser) .WithMany(p => p.MimeTypeCreatedByUsers) .HasForeignKey(d => d.CreatedByUserId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_MimeType_User_Created"); entity.HasOne(d => d.ModifiedByUser) .WithMany(p => p.MimeTypeModifiedByUsers) .HasForeignKey(d => d.ModifiedByUserId) .HasConstraintName("REL_MimeType_User_Modified"); }); modelBuilder.Entity(entity => { entity.ToTable("Registration"); entity.HasComment("Holds Process Server registrations"); entity.Property(e => e.Id).HasComment("Primary key of Registration record"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when registration was created"); entity.Property(e => e.DocumentFailedCnt).HasComment("# of failed documents"); entity.Property(e => e.DocumentProcessedCnt).HasComment("# of new processed documents"); entity.Property(e => e.PoolSize).HasComment("Defines how many documents can be reserved for processing at once."); entity.Property(e => e.Denided).HasComment("Defines if instance is denided to connect."); entity.Property(e => e.LastActivity) .HasColumnType("datetime") .HasComment("Timestamp latest activity"); entity.Property(e => e.LocationIp) .HasMaxLength(100) .IsUnicode(false) .HasColumnName("LocationIP") .HasComment("Process server instance identifier"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when registration was modified"); entity.Property(e => e.Psinstance) .HasMaxLength(100) .IsUnicode(false) .HasColumnName("PSInstance") .HasComment("Process server instance identifier"); }); modelBuilder.Entity(entity => { entity.ToTable("Statistic"); entity.HasComment("Holds statistics information on daily base"); entity.HasIndex(e => new { e.Year, e.Month, e.Day }, "IDX_DATE") .IsUnique(); entity.Property(e => e.Id).HasComment("Primary key of Statistic record"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when billing info was created"); entity.Property(e => e.Day).HasComment("Day number"); entity.Property(e => e.DocumentDownloadedCnt).HasComment("# of downloaded documents"); entity.Property(e => e.DocumentFailedCnt).HasComment("# of failed documents"); entity.Property(e => e.DocumentNewCnt).HasComment("# of new created/uploaded documents"); entity.Property(e => e.DocumentProcessedCnt).HasComment("# of processed documents"); entity.Property(e => e.DocumentTotalCnt).HasComment("# of all available documents"); entity.Property(e => e.InvoiceNewCnt).HasComment("# of new created invoices"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when billing info was modified"); entity.Property(e => e.Month).HasComment("Month number"); entity.Property(e => e.PsactiveCnt) .HasColumnName("PSActiveCnt") .HasComment("# of active ProcessServer instances"); entity.Property(e => e.UserLoginB2bcnt) .HasColumnName("UserLoginB2BCnt") .HasComment("# of logged B2B users"); entity.Property(e => e.UserLoginCnt).HasComment("# of logged users (incl B2B)"); entity.Property(e => e.UserNewCnt).HasComment("# of new created users"); entity.Property(e => e.UserTotalCnt).HasComment("# of all users (incl system)"); entity.Property(e => e.WorkspaceNewCnt).HasComment("# of new created workspaces"); entity.Property(e => e.WorkspaceTotalCnt).HasComment("# of all workspaces"); entity.Property(e => e.Year).HasComment("Year number"); entity.Property(e => e.YieldWorthCurrency) .IsRequired() .HasMaxLength(3) .IsUnicode(false) .HasComment("currency code of yieldworth"); entity.Property(e => e.YieldWorthSum) .HasColumnType("decimal(16, 4)") .HasComment("sum of daily yield worth"); entity.Property(e => e.YieldWorthTotalCurrency) .IsRequired() .HasMaxLength(3) .IsUnicode(false) .HasComment("currency code of yieldworth"); entity.Property(e => e.YieldWorthTotalSum) .HasColumnType("decimal(16, 4)") .HasComment("sum of daily yield worth"); }); modelBuilder.Entity(entity => { entity.ToTable("StatusHistory"); entity.HasComment("Stores metadocument status changing log with messages"); entity.Property(e => e.Id).HasComment("Primary key of metadocument status history record"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when metadocument was created (uploaded)"); entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) metadocument"); entity.Property(e => e.Message) .HasMaxLength(4000) .HasComment("Status change message or error message. This value is optional."); entity.Property(e => e.MetadocumentId).HasComment("Reference to owning metadocument"); entity.Property(e => e.Status).HasComment("Metadocument status"); entity.HasOne(d => d.CreatedByUser) .WithMany(p => p.StatusHistories) .HasForeignKey(d => d.CreatedByUserId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_StatusHistory_User_Created"); entity.HasOne(d => d.Metadocument) .WithMany(p => p.StatusHistories) .HasForeignKey(d => d.MetadocumentId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_StatusHistory_Metadocument"); }); modelBuilder.Entity(entity => { entity.ToTable("Structure"); entity.HasComment("Abstract repository structure (folder-like) where documents are assignig"); entity.Property(e => e.Id).HasComment("Structure primary key"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when workspace was created"); entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created workspace"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when workspace was modified"); entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated workspace"); entity.Property(e => e.Name) .IsRequired() .HasMaxLength(200) .HasComment("Structure name"); entity.Property(e => e.ParentId).HasComment("Reference to parent structure (folder). If null then record is root"); entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace"); entity.HasOne(d => d.Parent) .WithMany(p => p.InverseParent) .HasForeignKey(d => d.ParentId) .HasConstraintName("REL_Structure_Structure_Parent"); entity.HasOne(d => d.Workspace) .WithMany(p => p.Structures) .HasForeignKey(d => d.WorkspaceId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_Structure_Workspace"); }); modelBuilder.Entity(entity => { entity.ToTable("Tag"); entity.HasComment("Declares tag for workspace scope. Tag is used on metadocument."); entity.Property(e => e.Id).HasComment("Primary key of tag record"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when billing info was created"); entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when billing info was modified"); entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info"); entity.Property(e => e.Name) .IsRequired() .HasMaxLength(50) .HasComment("Tag name"); entity.Property(e => e.Rgb) .IsRequired() .HasMaxLength(50) .IsUnicode(false) .HasColumnName("RGB") .HasComment("Tag color in RGB format"); entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace"); entity.HasOne(d => d.CreatedByUser) .WithMany(p => p.TagCreatedByUsers) .HasForeignKey(d => d.CreatedByUserId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_Tag_User_Created"); entity.HasOne(d => d.ModifiedByUser) .WithMany(p => p.TagModifiedByUsers) .HasForeignKey(d => d.ModifiedByUserId) .HasConstraintName("REL_Tag_User_Modified"); entity.HasOne(d => d.Workspace) .WithMany(p => p.Tags) .HasForeignKey(d => d.WorkspaceId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_Tag_Workspace"); }); modelBuilder.Entity(entity => { entity.ToTable("User"); entity.HasComment("User identity with properties"); entity.HasIndex(e => e.Ifreference, "IDX_IFREFERENCE") .IsUnique(); entity.HasIndex(e => e.Name, "IDX_USER_NAME") .IsUnique(); entity.Property(e => e.Id).HasComment("User primary key"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when user was created"); entity.Property(e => e.Ifreference) .IsRequired() .HasMaxLength(50) .IsUnicode(false) .HasColumnName("IFReference") .HasComment("Reference to Identity framework IdentityUser.Id"); entity.Property(e => e.IsEnabled).HasComment("Flag if user can sign on"); entity.Property(e => e.IsSystem).HasComment("Flag if user is system only account. Cannot log in."); entity.Property(e => e.LangLcid) .HasColumnName("LangLCID") .HasDefaultValueSql("((1033))") .HasComment("LCID of preffered user language"); entity.Property(e => e.LastDisabled) .HasColumnType("datetime") .HasComment("Timestamp of last user set to be disabled"); entity.Property(e => e.LastEnabled) .HasColumnType("datetime") .HasComment("Timestamp of last user set to be enabled"); entity.Property(e => e.LastLogged) .HasColumnType("datetime") .HasComment("Timestamp of user last successful login"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when user was modified"); entity.Property(e => e.Name) .IsRequired() .HasMaxLength(200) .HasComment("Full user name"); }); modelBuilder.Entity(entity => { // entity.HasNoKey(); entity.ToTable("UserWorkspace"); entity.HasComment("Association between User and Workspace. Which Workspace is assigned to user."); entity.Property(e => e.IsDefault).HasComment("Flag if relation is default"); entity.Property(e => e.UserId).HasComment("Reference to user record"); entity.Property(e => e.WorkspaceId).HasComment("Reference to workspace record"); entity.HasOne(d => d.User) .WithMany() .HasForeignKey(d => d.UserId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_UserWorkspace_User"); entity.HasOne(d => d.Workspace) .WithMany() .HasForeignKey(d => d.WorkspaceId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_UserWorkspace_Workspace"); }); modelBuilder.Entity(entity => { entity.ToTable("Workspace"); entity.HasComment("Main workspace root structure holds information about working space (set of documents) and their business plan"); entity.Property(e => e.Id).HasComment("Workspace primary key"); entity.Property(e => e.Apikey) .HasColumnName("APIKey") .HasDefaultValueSql("(newid())") .HasComment("API Key for access to workspace via B2B interface"); entity.Property(e => e.Apipassword) .IsRequired() .HasMaxLength(50) .HasColumnName("APIPassword") .HasComment("API Key Password for access to workspace via B2B interface"); entity.Property(e => e.BillingInfoId).HasComment("Reference to current billing info record"); entity.Property(e => e.BillingPlanId).HasComment("Reference to current billing plan record"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when workspace was created"); entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created workspace"); entity.Property(e => e.IsGold).HasComment("Define if workspace is GOLD mode (has custom billing plan)"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when workspace was modified"); entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated workspace"); entity.Property(e => e.Name) .IsRequired() .HasMaxLength(200) .HasComment("Workspace name"); //entity.HasOne(d => d.BillingInfo) // .WithMany(p => p.Workspaces) // .HasForeignKey(d => d.BillingInfoId) // .HasConstraintName("REL_Workspace_BillingInfo"); entity.HasOne(d => d.CreatedByUser) .WithMany(p => p.WorkspaceCreatedByUsers) .HasForeignKey(d => d.CreatedByUserId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_Workspace_User_Created"); entity.HasOne(d => d.ModifiedByUser) .WithMany(p => p.WorkspaceModifiedByUsers) .HasForeignKey(d => d.ModifiedByUserId) .HasConstraintName("REL_Workspace_User_Modified"); }); modelBuilder.Entity(entity => { entity.ToTable("WorkspaceBilling"); entity.HasComment("Deffines current state of billing plan for workspace"); entity.Property(e => e.Id).HasComment("Primary key of WorkspaceBilling record"); entity.Property(e => e.BillingPlanId).HasComment("Reference to billing plan"); entity.Property(e => e.Created) .HasColumnType("datetime") .HasDefaultValueSql("(getdate())") .HasComment("Timestamp when billing was created"); entity.Property(e => e.CustomPstcreditsPerItem) .HasColumnName("CustomPSTCreditsPerItem") .HasComment("Custom Preset Override - single item credit cost"); entity.Property(e => e.CustomPstinitialCredits) .HasColumnName("CustomPSTInitialCredits") .HasComment("Custom Preset Override - initial credit amount"); entity.Property(e => e.CustomPstprocessProfile) .HasMaxLength(5) .IsUnicode(false) .HasColumnName("CustomPSTProcessProfile") .HasComment("Custom Preset Override - processing profile code"); entity.Property(e => e.CustomPstquality) .HasColumnName("CustomPSTQuality") .HasComment("Custom Preset Override - process quality 0 = lowest"); entity.Property(e => e.CustomPsttest) .HasColumnName("CustomPSTTest") .HasComment("Custom Preset Override - testing mode"); entity.Property(e => e.CustomPstwatermark) .HasColumnName("CustomPSTWatermark") .HasComment("Custom Preset Override - watermarked"); entity.Property(e => e.Modified) .HasColumnType("datetime") .HasComment("Timestamp when billing was modified"); entity.Property(e => e.ValueDate) .HasColumnType("datetime") .HasComment("DateTime value of billing plan spending. Depends on BillingPlan"); entity.Property(e => e.ValueNumber) .HasColumnType("decimal(16, 4)") .HasComment("Numeric value of billing plan spending. Depends on BillingPlan."); entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace"); entity.HasOne(d => d.BillingPlan) .WithMany(p => p.WorkspaceBillings) .HasForeignKey(d => d.BillingPlanId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_WorkspaceBilling_BillingPlan"); entity.HasOne(d => d.Workspace) .WithMany(p => p.WorkspaceBillings) .HasForeignKey(d => d.WorkspaceId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("REL_WorkspaceBilling_Workspace"); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); } }