I am performing a proof of concept for using Azure Cosmos DB. I am following these steps to use Azure Cosmos DB from mvc/jquery ABP.IO application. https://docs.abp.io/en/abp/latest/Entity-Framework-Core-Other-DBMS I am at the last step of "Re-Generate the Migrations". However i started getting exceptions for many tables for the concurrencyStamp property which i resolved one by one by using the IsETagConcurrency() and it worked for all entities so far. But its not working for the <ApiResource> entity.
I tried ignoring the entity but still getting the same error. Its not ignored at all. Maybe since its defined in the matadata ?
<br> Could you please help me since i think my Azure Cosmos will work if this issue is resolved.
19 Answer(s)
-
0
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
-
0
sure . will share now.Thanks.
-
0
@maliming Shared the project with you
-
0
hi kirtik
I will check as soon as possible. : )
-
0
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)); } }
-
0
-
0
hi @kirtik
The png you shared is not clear. Can you share the text?
-
0
-
0
using Volo.Abp.Domain.Entities;
-
0
No it is not resolved. I have already referenced -- using Volo.Abp.Domain.Entities;
-
0
hi Maybe it is
using System;
-
0
Yes. That worked !! Thanks
-
0
: )
-
0
-
0
hi
Are you sure the Cosmos need migrations?
-
0
same error with update-database. I need to be able to migrate the Book entity from this project to Azure Cosmos.
-
0
hi kirtik
I am not familiar with Cosmos, but it does not seem to need to migrate and update the database.
https://docs.microsoft.com/en-us/ef/core/providers/cosmos/?tabs=dotnet-core-cli
-
0
Yes @maliming . I am thinking too. Let me go through the link . Thnaks for your support .
-
0
@kirtik 👍