using System; using System.Collections.Generic; using Entities.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; namespace Entities { public partial class RepositoryContext : DbContext { public RepositoryContext() { } public RepositoryContext(DbContextOptions options) : base(options) { } public virtual DbSet BankAccountBalances { get; set; } = null!; public virtual DbSet BankOperations { get; set; } = null!; public virtual DbSet Transactions { get; set; } = null!; protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => { entity.ToTable("SK_BankAccountBalances", "SEPTEM"); entity.HasIndex(e => e.BankAccountId, "IX_SK_BankAccountBalances_BankAccountId"); entity.Property(e => e.Id).ValueGeneratedNever(); entity.Property(e => e.Amount).HasPrecision(18, 3); entity.Property(e => e.BalanceType).HasMaxLength(50); }); modelBuilder.Entity(entity => { entity.ToTable("SK_BankOperations", "SEPTEM"); entity.HasIndex(e => e.BankAccountId, "IX_SK_BankOperations_BankAccountId"); entity.HasIndex(e => e.CashOperationTypeId, "IX_SK_BankOperations_CashOperationTypeId"); entity.HasIndex(e => e.CustomerId, "IX_SK_BankOperations_CustomerId"); entity.HasIndex(e => e.OperationPurposeId, "IX_SK_BankOperations_OperationPurposeId"); entity.Property(e => e.Id).ValueGeneratedNever(); entity.Property(e => e.AdvanceAmount).HasPrecision(18, 2); entity.Property(e => e.BalanceAmount).HasPrecision(18, 2); entity.Property(e => e.Code).HasMaxLength(50); entity.Property(e => e.CreatedDate).HasColumnType("timestamp without time zone"); entity.Property(e => e.DocDate).HasColumnType("timestamp without time zone"); entity.Property(e => e.IncomeAmount).HasPrecision(18, 2); entity.Property(e => e.ModifiedDate).HasColumnType("timestamp without time zone"); entity.Property(e => e.Note).HasMaxLength(5000); entity.Property(e => e.OutcomeAmount).HasPrecision(18, 2); entity.Property(e => e.Purpose).HasMaxLength(150); entity.Property(e => e.Status).HasMaxLength(50); entity.Property(e => e.IsChanged).HasDefaultValue(false); entity.Property(e => e.OrderId); }); modelBuilder.Entity(entity => { entity.ToTable("SK_Transactions", "SEPTEM"); entity.HasIndex(e => e.BankOperationId, "IX_SK_Transactions_BankOperationId"); entity.Property(e => e.Id).ValueGeneratedNever(); entity.Property(e => e.BalanceAmount).HasPrecision(18, 2); entity.Property(e => e.IncomeAmount).HasPrecision(18, 2); entity.Property(e => e.OutcomeAmount).HasPrecision(18, 2); entity.Property(e => e.ChangedDifference).HasPrecision(18, 2); entity.Property(e => e.Status).HasMaxLength(30); entity.Property(e => e.IsChanged); entity.Property(e => e.ModifiedDate).HasColumnType("timestamp without time zone"); entity.Property(e => e.CreateDate).HasColumnType("timestamp without time zone"); entity.Property(e => e.OperationCreateDate).HasColumnType("timestamp without time zone"); entity.HasIndex(e => e.BankAccountId, "IX_SK_Transactions_BankAccountId"); entity.HasIndex(e => e.BusinessId); entity.Property(e => e.OperationOrderId); entity.HasOne(d => d.BankOperation) .WithMany(p => p.SkTransactions) .HasForeignKey(d => d.BankOperationId) .HasForeignKey(d => d.BankAccountId); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); } }