posted the screenshots in case someone else is facing the same issue
Hello
Thank you that fixed the issue
I did added them and test but that did not fix the issue. I tried with appsettings.json and appsettings.secrets.json under TestBase and without that both of them did not fix the issue
we are using 5.2.1 also. I can provide team viewer if you want
OK can you refund the ticket please
We tried everything possible
Yes we were testing on the master branch and code is same. strange. we are 3 developers suite was working on my machine only both of my co worker were have the same error
@yekalkan I can provide team viewer to my PC if that will help you investigating the issue
I am sure we are both using the 5.2.1 of cli and suite
using CashinIntro.SaasService.StoreSettingGroups;
using CashinIntro.SaasService.Cities;
using CashinIntro.SaasService.CityTranslations;
using CashinIntro.SaasService.Concepts;
using CashinIntro.SaasService.ConceptTranslations;
using CashinIntro.SaasService.Countries;
using CashinIntro.SaasService.CountryTranslations;
using CashinIntro.SaasService.Stores;
using CashinIntro.SaasService.StoreTags;
using CashinIntro.SaasService.StoreTranslations;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Volo.Payment.EntityFrameworkCore;
using Volo.Payment.Plans;
using Volo.Payment.Requests;
using Volo.Saas.Editions;
using Volo.Saas.EntityFrameworkCore;
using Volo.Saas.Tenants;
namespace CashinIntro.SaasService.EntityFramework;
[ConnectionStringName(SaasServiceDbProperties.ConnectionStringName)]
public class SaasServiceDbContext : AbpDbContext<SaasServiceDbContext>, ISaasDbContext, IPaymentDbContext
{
public DbSet<StoreSettingGroup> StoreSettingGroups { get; set; }
public SaasServiceDbContext(DbContextOptions<SaasServiceDbContext> options)
: base(options)
{
}
public DbSet<ConceptTranslation> ConceptTranslations { get; set; }
public DbSet<CityTranslation> CityTranslations { get; set; }
public DbSet<City> Cities { get; set; }
public DbSet<CountryTranslation> CountryTranslations { get; set; }
public DbSet<Country> Countries { get; set; }
public DbSet<Store> Stores { get; set; }
public DbSet<StoreTranslation> StoreTranslations { get; set; }
public DbSet<StoreTag> StoreTags { get; set; }
public DbSet<Concept> Concepts { get; set; }
public DbSet<PaymentRequest> PaymentRequests { get; set; }
public DbSet<Plan> Plans { get; set; }
public DbSet<GatewayPlan> GatewayPlans { get; set; }
public DbSet<Tenant> Tenants { get; set; }
public DbSet<Edition> Editions { get; set; }
public DbSet<TenantConnectionString> TenantConnectionStrings { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.ConfigureCashinIntroSaas();
/* Define mappings for your custom entities here...
modelBuilder.Entity<MyEntity>(b =>
{
b.ToTable(IdentityServiceDbProperties.DbTablePrefix + "MyEntities", IdentityServiceDbProperties.DbSchema);
b.ConfigureByConvention();
//TODO: Configure other properties, indexes... etc.
});
*/
if (builder.IsHostDatabase())
{
builder.Entity<Country>(b =>
{
b.ToTable(SaasServiceDbProperties.DbTablePrefix + "Country", SaasServiceDbProperties.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.DefaultName).HasColumnName(nameof(Country.DefaultName)).IsRequired().HasMaxLength(CountryConsts.DefaultNameMaxLength);
});
}
builder.Entity<CountryTranslation>(b =>
{
b.ToTable(SaasServiceDbProperties.DbTablePrefix + "CountryTranslation", SaasServiceDbProperties.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.TenantId).HasColumnName(nameof(CountryTranslation.TenantId));
b.Property(x => x.DisplayName).HasColumnName(nameof(CountryTranslation.DisplayName)).HasMaxLength(CountryTranslationConsts.DisplayNameMaxLength);
b.Property(x => x.PrinterName).HasColumnName(nameof(CountryTranslation.PrinterName)).HasMaxLength(CountryTranslationConsts.PrinterNameMaxLength);
b.Property(x => x.WebName).HasColumnName(nameof(CountryTranslation.WebName)).HasMaxLength(CountryTranslationConsts.WebNameMaxLength);
b.Property(x => x.LanguageId).HasColumnName(nameof(CountryTranslation.LanguageId));
b.HasOne<Country>().WithMany().IsRequired().HasForeignKey(x => x.CoreId);
});
builder.Entity<City>(b =>
{
b.ToTable(SaasServiceDbProperties.DbTablePrefix + "City", SaasServiceDbProperties.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.TenantId).HasColumnName(nameof(City.TenantId));
b.Property(x => x.DefaultName).HasColumnName(nameof(City.DefaultName)).IsRequired().HasMaxLength(CityConsts.DefaultNameMaxLength);
});
builder.Entity<CityTranslation>(b =>
{
b.ToTable(SaasServiceDbProperties.DbTablePrefix + "CityTranslation", SaasServiceDbProperties.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.TenantId).HasColumnName(nameof(CityTranslation.TenantId));
b.Property(x => x.DisplayName).HasColumnName(nameof(CityTranslation.DisplayName)).HasMaxLength(CityTranslationConsts.DisplayNameMaxLength);
b.Property(x => x.PrinterName).HasColumnName(nameof(CityTranslation.PrinterName)).HasMaxLength(CityTranslationConsts.PrinterNameMaxLength);
b.Property(x => x.WebName).HasColumnName(nameof(CityTranslation.WebName)).HasMaxLength(CityTranslationConsts.WebNameMaxLength);
b.Property(x => x.LanguageId).HasColumnName(nameof(CityTranslation.LanguageId));
b.HasOne<City>().WithMany().IsRequired().HasForeignKey(x => x.CoreId);
});
builder.Entity<Concept>(b =>
{
b.ToTable(SaasServiceDbProperties.DbTablePrefix + "Concept", SaasServiceDbProperties.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.TenantId).HasColumnName(nameof(Concept.TenantId));
b.Property(x => x.DefaultName).HasColumnName(nameof(Concept.DefaultName)).IsRequired().HasMaxLength(ConceptConsts.DefaultNameMaxLength);
});
builder.Entity<ConceptTranslation>(b =>
{
b.ToTable(SaasServiceDbProperties.DbTablePrefix + "ConceptTranslation", SaasServiceDbProperties.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.TenantId).HasColumnName(nameof(ConceptTranslation.TenantId));
b.Property(x => x.DisplayName).HasColumnName(nameof(ConceptTranslation.DisplayName)).HasMaxLength(ConceptTranslationConsts.DisplayNameMaxLength);
b.Property(x => x.PrinterName).HasColumnName(nameof(ConceptTranslation.PrinterName)).HasMaxLength(ConceptTranslationConsts.PrinterNameMaxLength);
b.Property(x => x.WebName).HasColumnName(nameof(ConceptTranslation.WebName)).HasMaxLength(ConceptTranslationConsts.WebNameMaxLength);
b.Property(x => x.LanguageId).HasColumnName(nameof(ConceptTranslation.LanguageId));
b.HasOne<Concept>().WithMany().IsRequired().HasForeignKey(x => x.CoreId);
});
builder.Entity<StoreTranslation>(b =>
{
b.ToTable(SaasServiceDbProperties.DbTablePrefix + "StoreTranslation", SaasServiceDbProperties.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.TenantId).HasColumnName(nameof(StoreTranslation.TenantId));
b.Property(x => x.DisplayName).HasColumnName(nameof(StoreTranslation.DisplayName)).HasMaxLength(StoreTranslationConsts.DisplayNameMaxLength);
b.Property(x => x.PrinterName).HasColumnName(nameof(StoreTranslation.PrinterName)).HasMaxLength(StoreTranslationConsts.PrinterNameMaxLength);
b.Property(x => x.WebName).HasColumnName(nameof(StoreTranslation.WebName)).HasMaxLength(StoreTranslationConsts.WebNameMaxLength);
b.Property(x => x.LanguageId).HasColumnName(nameof(StoreTranslation.LanguageId));
b.Property(x => x.Address).HasColumnName(nameof(StoreTranslation.Address)).HasMaxLength(StoreTranslationConsts.AddressMaxLength);
b.HasOne<Store>().WithMany().IsRequired().HasForeignKey(x => x.CoreId);
});
builder.Entity<StoreTag>(b =>
{
b.ToTable(SaasServiceDbProperties.DbTablePrefix + "StoreTag", SaasServiceDbProperties.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.TenantId).HasColumnName(nameof(StoreTag.TenantId));
b.Property(x => x.Name).HasColumnName(nameof(StoreTag.Name)).IsRequired().HasMaxLength(StoreTagConsts.NameMaxLength);
});
builder.Entity<Store>(b =>
{
b.ToTable(SaasServiceDbProperties.DbTablePrefix + "Stores", SaasServiceDbProperties.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.TenantId).HasColumnName(nameof(Store.TenantId));
b.Property(x => x.DefaultName).HasColumnName(nameof(Store.DefaultName)).IsRequired().HasMaxLength(StoreConsts.DefaultNameMaxLength);
b.Property(x => x.StoreId).HasColumnName(nameof(Store.StoreId)).HasMaxLength(StoreConsts.StoreIdMaxLength);
b.Property(x => x.ReferenceId).HasColumnName(nameof(Store.ReferenceId)).HasMaxLength(StoreConsts.ReferenceIdMaxLength);
b.Property(x => x.Address).HasColumnName(nameof(Store.Address)).HasMaxLength(StoreConsts.AddressMaxLength);
b.Property(x => x.Telephone).HasColumnName(nameof(Store.Telephone)).HasMaxLength(StoreConsts.TelephoneMaxLength);
b.Property(x => x.State).HasColumnName(nameof(Store.State)).HasMaxLength(StoreConsts.StateMaxLength);
b.Property(x => x.PostalCode).HasColumnName(nameof(Store.PostalCode)).HasMaxLength(StoreConsts.PostalCodeMaxLength);
b.Property(x => x.GeoFencing).HasColumnName(nameof(Store.GeoFencing)).HasMaxLength(StoreConsts.GeoFencingMaxLength);
b.Property(x => x.Location).HasColumnName(nameof(Store.Location)).HasMaxLength(StoreConsts.LocationMaxLength);
b.Property(x => x.Status).HasColumnName(nameof(Store.Status)).IsRequired();
b.Property(x => x.OpenTime).HasColumnName(nameof(Store.OpenTime));
b.Property(x => x.CloseTime).HasColumnName(nameof(Store.CloseTime));
b.Property(x => x.CloseTimeNextDay).HasColumnName(nameof(Store.CloseTimeNextDay));
b.Property(x => x.Mobile).HasColumnName(nameof(Store.Mobile)).HasMaxLength(StoreConsts.MobileMaxLength);
b.HasOne<City>().WithMany().IsRequired().HasForeignKey(x => x.CityId);
b.HasOne<Country>().WithMany().IsRequired().HasForeignKey(x => x.CountryId);
b.HasOne<Concept>().WithMany().IsRequired().HasForeignKey(x => x.ConceptId);
b.HasMany(x => x.StoreTags).WithOne().HasForeignKey(x => x.StoreId).IsRequired();
});
builder.Entity<StoreStoreTag>(b =>
{
b.ToTable(SaasServiceDbProperties.DbTablePrefix + "StoreStoreTag" + SaasServiceDbProperties.DbSchema);
b.ConfigureByConvention();
//define composite key
b.HasKey(
x => new { x.StoreId, x.StoreTagId }
);
//many-to-many configuration
b.HasOne<Store>().WithMany(x => x.StoreTags).HasForeignKey(x => x.StoreId).IsRequired();
b.HasOne<StoreTag>().WithMany().HasForeignKey(x => x.StoreTagId).IsRequired();
b.HasIndex(
x => new { x.StoreId, x.StoreTagId }
);
});
builder.Entity<StoreSettingGroup>(b =>
{
b.ToTable(SaasServiceDbProperties.DbTablePrefix + "StoreSettingGroup", SaasServiceDbProperties.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.TenantId).HasColumnName(nameof(StoreSettingGroup.TenantId));
b.Property(x => x.Name).HasColumnName(nameof(StoreSettingGroup.Name)).IsRequired().HasMaxLength(StoreSettingGroupConsts.NameMaxLength);
b.HasMany(x => x.Stores).WithOne().HasForeignKey(x => x.StoreSettingGroupId).IsRequired().OnDelete(DeleteBehavior.NoAction);
});
builder.Entity<StoreSettingGroupStore>(b =>
{
b.ToTable(SaasServiceDbProperties.DbTablePrefix + "StoreSettingGroupStore" + SaasServiceDbProperties.DbSchema);
b.ConfigureByConvention();
b.HasKey(
x => new { x.StoreSettingGroupId, x.StoreId }
);
b.HasOne<StoreSettingGroup>().WithMany(x => x.Stores).HasForeignKey(x => x.StoreSettingGroupId).IsRequired().OnDelete(DeleteBehavior.NoAction);
b.HasOne<Store>().WithMany().HasForeignKey(x => x.StoreId).IsRequired().OnDelete(DeleteBehavior.NoAction);
b.HasIndex(
x => new { x.StoreSettingGroupId, x.StoreId }
);
});
}
}