Activités de "MichelZ"

We also might start tweeting them...

https://twitter.com/abpcommercial https://twitter.com/volosoftcompany https://twitter.com/hibrahimkalkan

It's urgent.

Same here

Question

Hi

Using abp 4.4 with EF/SQL Server.

We don't like using "Id" as the column name for our entities, so we are using this workaround: https://github.com/aspnetboilerplate/aspnetboilerplate/issues/586#issuecomment-135599562

It does work fine for entities that don't have a Guid Key. Once the Key is Guid, things start to break down. EF throws errors that the "Id column was not found".

We have found the cause of it, it's AbpDbContext.TrySetGuidId and AbpDbContext.ConfigureValueGenerated

We have also found a suitable workaround by overriding these functions like this:

protected override void TrySetGuidId(EntityEntry entry, IEntity<Guid> entity)
        {
            if (entry.Metadata.FindProperty("Id") == null)
            {
                // Ignore this, it's because we have removed the Id property.
                return;
            }

            base.TrySetGuidId(entry, entity);
        }

        protected override void ConfigureValueGenerated<TEntity>(ModelBuilder modelBuilder, IMutableEntityType mutableEntityType)
            where TEntity : class
        {
            if (!typeof(IEntity<Guid>).IsAssignableFrom(typeof(TEntity)))
            {
                return;
            }

            // Ignore if Id has NotMapped attribute
            var type = mutableEntityType.ClrType;
            var propertyInfo = type.GetProperty("Id", BindingFlags.DeclaredOnly |
                                                      BindingFlags.Public |
                                                      BindingFlags.Instance);

            if (propertyInfo != null)
            {
                var attribute = propertyInfo.GetCustomAttribute(typeof(NotMappedAttribute));
                if (attribute != null)
                {
                    return;
                }
            }

            base.ConfigureValueGenerated<TEntity>(modelBuilder, mutableEntityType);
        }

The configureValueGenerated function does create the property when it does not exist. So even when it was excluded with [NotMapped], this line from AbpDbContext adds it: var idPropertyBuilder = modelBuilder.Entity().Property(x => ((IEntity)x).Id);

(Note the documentation saying that "Returns an object that ban be used to configure a property of the entity type. If the specified property is not already part of the model, it will be added.")

So the Id property is added to the model if the type is Guid.

Then the TrySetGuidId also expects the Id property to be there: var idProperty = entry.Property("Id").Metadata.PropertyInfo;

Which of course fails, too.

Now to the question:

  • Is this the right way to handle this situation, or do you see a better way?
  • Are there some improvements for ABP that you can do to better support this scenario?

Thanks Michel

Hi @ismcagdas

I have mostly switched away from a docker-based local workflow that needs frequent downloading of packages, so I can't really say for sure. Might try again in the future, but good to know that improvements were made, thank you!

Thanks

And I have this issue again with 409. I haven't heard back from my e-mail about IP Addresses....

#28 2.185 Determining projects to restore... #28 15.20 Failed to download package 'Volo.Abp.TextTemplateManagement.Domain.Shared.4.4.2' from 'https://nuget.abp.io/<key>/v3/package/volo.abp.texttemplatemanagement.domain.shared/4.4.2/volo.abp.texttemplatemanagement.domain.shared.4.4.2.nupkg'. #28 15.20 Response status code does not indicate success: 409 (Conflict). #28 33.23 Failed to download package 'Volo.Abp.Account.Pro.Shared.Application.4.4.2' from 'https://nuget.abp.io/<key>/v3/package/volo.abp.account.pro.shared.application/4.4.2/volo.abp.account.pro.shared.application.4.4.2.nupkg'. #28 33.23 Response status code does not indicate success: 409 (Conflict).

Hi @MichelZ

I'm not %100 sure but your requests might be blocked by our firewall. Is it possible to share your IP with us so we can check this ? You can share it with info@abp.io.

Also, using a nuget cache for your docker builds might help to solve this problem and speed up your development, see https://stackoverflow.com/questions/60799918/using-nuget-cache-inside-a-docker-build-with-net-core-when-offline.

Thanks, I have sent an e-mail. The BuildKit thing is a good idea and I will look into this, thank you!

Hi

No, it is not. This is for pushing packages - where a 409-Conflict makes absolutely sense. Here, we are not pushing any packages, it's just a package restore.

  • ABP Framework version: v4.4.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes

We are using docker to develop a solution using abp. This means docker will often need to download ABP packages. We often get the following error with multiple packages, sometimes for hours, and then the error suddenly disappears. We don't know what to do currently and would like to ask for help.

#132 43.50 /usr/share/dotnet/sdk/5.0.400/NuGet.targets(131,5): error : Failed to download package 'Volo.Abp.Account.Pro.Shared.Application.4.4.2' from 'https://nuget.abp.io/redacted/v3/package/volo.abp.account.pro.shared.application/4.4.2/volo.abp.account.pro.shared.application.4.4.2.nupkg'. [/src/src/company.product.AgentHttpApi.Host/company.product.AgentHttpApi.Host.csproj] #132 43.50 /usr/share/dotnet/sdk/5.0.400/NuGet.targets(131,5): error : Response status code does not indicate success: 409 (Conflict). [/src/src/company.product.AgentHttpApi.Host/company.product.AgentHttpApi.Host.csproj]

The step that provokes this is: RUN dotnet restore "src/company.product.AgentHttpApi.Host/company.product.AgentHttpApi.Host.csproj" --configfile "nuget.config"

Any idea what could cause this?

Thanks Michel

Any chance that this could be improved? We use a one-db-per-tenant approach as well, and having TenantID columns is just distracting :)

Hi @MichelZ

Yes, the release of 4.4.1 is still in progress, could you try again when the release is completed. We hope to complete it today.

Thanks,

Hi

The problem is not updating to 4.4.1, the problem is that all of my workflow starts to fail with the current version. All nuget restores for 4.4.0 started failing yesterday with the conflict message. This is very disruptive as I'm using docker to build this like every couple of minutes, and docker doesn't cache the packages, so I can't really build anymore.

Affichage de 31 à 40 sur 54 entrées
Made with ❤️ on ABP v8.2.0-preview Updated on mars 25, 2024, 15:11