Activities of "maliming"

Answer

The reason for this situation may be that the __EFMigrationsHistory table is empty after the first execution of DBMigrator.

hi kirtik

You can try this.

protected override void OnModelCreating(ModelBuilder builder)
{
	base.OnModelCreating(builder);

	/* Include modules to your migration db context */

	builder.ConfigurePermissionManagement();
	builder.ConfigureSettingManagement();
	builder.ConfigureBackgroundJobs();
	builder.ConfigureAuditLogging();
	builder.ConfigureIdentity();
	builder.ConfigureIdentityServer();
	builder.ConfigureFeatureManagement();
	builder.ConfigureTenantManagement();
	builder.UseCosmos();


	/* Configure your own tables/entities inside the ConfigureBookStore method */

	builder.ConfigureBookStore();

	foreach (var entityType in builder.Model.GetEntityTypes())
	{
		ConfigureETagConcurrency(builder, entityType);
	}
}

private void ConfigureETagConcurrency(ModelBuilder modelBuilder, IMutableEntityType mutableEntityType)
{
	if (mutableEntityType.IsOwned())
	{
		return;
	}

	if (!typeof(IEntity).IsAssignableFrom(mutableEntityType.ClrType))
	{
		return;
	}

	var entityTypeBuilder = modelBuilder.Entity(mutableEntityType.ClrType);

	if (entityTypeBuilder.Metadata.ClrType.IsAssignableTo<IHasConcurrencyStamp>())
	{
		entityTypeBuilder.Property(nameof(IHasConcurrencyStamp.ConcurrencyStamp))
			.IsETagConcurrency()
			.HasMaxLength(ConcurrencyStampConsts.MaxLength)
			.HasColumnName(nameof(IHasConcurrencyStamp.ConcurrencyStamp));
	}
}
Answer

If I cannot reproduce the problem, I cannot solve the problem. : (

Answer

hi

I mean can you find some differences between your project and the template project that might be causing the problem.

That is, if you copy some code of your project to the template project, the above problem occurs.

Answer

hi shobhit

Can you reproduce the problem in the 4.0 template project? You can try it. In that way I can quickly locate the problem.

Answer

hi @shobhit

Can you reproduce the problem in the 4.0 template project? Because I see you are using different connection strings for different modules.

https://docs.abp.io/en/abp/latest/Entity-Framework-Core-Migrations

Answer

Please back up the code and database.

  1. delete the Migrations folder.
  2. run dotnet ef migrations add Initialcommand in xxx.EntityFrameworkCore.DbMigrations folder.
  3. run dotnet ef database update command or run xxx.DbMigrator to apply.

https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/

hi kirtik

I will check as soon as possible. : )

Answer

hi

You can consider deleting all migrations and then adding a new one. You can delete the Migrations folder.

Please backup the database before trying.

Re-adding the migration will solve your problem.

This is a simple way, otherwise I need to get the source code of your project to check.

hi kirtik

Maybe you don't need to configure one by one.

Can you share with me a sample project using Azure Cosmos DB? I can check it.

liming.ma@volosoft.com

Showing 7561 to 7570 of 7733 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 08:30