Ends in:
4 DAYS
19 HRS
56 MIN
15 SEC
Ends in:
4 D
19 H
56 M
15 S
Open Closed

Stuck on migration 5.1.2 => 7.0.1 (Oracle) #4565


User avatar
0
alexander.nikonov created
  • ABP Framework version: v5.1.2
  • UI type: Angular
  • DB provider: EF Core
  • Identity Server Separated (Angular)

I have a couple of issues / questions with the migration.

Server side: probably because of absent Devart Oracle driver which supports .NET 7.0+ the Add-Migration causes the following error (please note that we have set target=NET7 for all our projects):

Return type in method 'Devart.Common.Entity.c5.FindMapping(System.Type)' on type 'Devart.Common.Entity.c5' from assembly 'Devart.Data.Oracle.Entity.EFCore, Version=9.16.1434.0, Culture=neutral, PublicKeyToken=09af7300eec23701' is not compatible with base type method 'Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingSource.FindMapping(System.Type)'.

The Add-Migration itself with the standard driver completes successfully, but when I run Update-Database - very soon I end up with the errors related to Upper / Lower case in Table/Column names + quotes around those. We did not have such problems with Devart thanks to these options:

        var config = Devart.Data.Oracle.Entity.Configuration.OracleEntityProviderConfig.Instance;
        config.Workarounds.DisableQuoting = true;
        config.CodeFirstOptions.UseNonLobStrings = true;
        config.CodeFirstOptions.UseNonUnicodeStrings = true;

How to make a successful migration? Sorry - I cannot share the source code.

Client side: it is not clear which version of Angular should we use now, with ABP 7.0.1. We have had Angular 13 so far...I've tried to upgrade Angular after using abp update, but faced the compilation problem for our Angular packages, similar to these, but related to ng-bootstrap and other material components. So what Angular version should we use? Should we upgrade from version 13 and how to make it correct?


9 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Server side: probably because of absent Devart Oracle driver which supports .NET 7.0+ the Add-Migration causes the following error (please note that we have set target=NET7 for all our projects):

    As you know, Devart Oracle still doesn't support NET7.0, so it doesn't work correctly: https://docs.abp.io/en/abp/latest/Migration-Guides/Abp-7_0#devart-data-oracle-efcore

    Client side: it is not clear which version of Angular should we use now,

    Now it's Angular 15: https://github.com/abpframework/abp/pull/14859

  • User Avatar
    0
    alexander.nikonov created

    Unfortunately, we don't have time and need to migrate now. So we need to use a generic Oracle driver. The script which is generated by the generic driver, looks weird, though - it suggests to replace VARCHAR fields in ABP tables with NVARCHAR. There are a lot of such changes. Could you please explain, why in a 7.0.1 test app you are suggesting to use NVARCHAR/NVARCHAR2 DB type:

    but at the same time the suggested Devart-based DB configuration has the following options, i.e. the DB fields are generated as VARCHAR/VARCHAR2?

    So currently the generated migration script has tons of suggested changes like this (it compares the previously created migration using Devart and a generic dviver generation now):

    I've tried to get rid of NVARCHAR manually in the DB migration context:

        protected override void OnModelCreating(ModelBuilder builder)
        {
            //var config = Devart.Data.Oracle.Entity.Configuration.OracleEntityProviderConfig.Instance;
            //config.Workarounds.DisableQuoting = true;
            //config.CodeFirstOptions.UseNonLobStrings = true;
            //config.CodeFirstOptions.UseNonUnicodeStrings = true;
    
            base.OnModelCreating(builder);
    
            /* Include modules to your migration db context */
    
            builder.ConfigurePermissionManagement();
            builder.ConfigureSettingManagement();
            builder.ConfigureBackgroundJobs();
            builder.ConfigureAuditLogging();
            builder.ConfigureIdentityPro();
            builder.ConfigureIdentityServer();
            builder.ConfigureFeatureManagement();
            builder.ConfigureLanguageManagement();
            builder.ConfigureTextTemplateManagement();
            builder.ConfigureBlobStoring();
            builder.ConfigureSaas();
            
            foreach (var property in builder.Model.GetEntityTypes().SelectMany(e => e.GetProperties()).Where(p => p.ClrType == typeof(string)))
            {
                property.SetIsUnicode(false);
            }
        }
    

    But it still generates me migration script with NVARCHAR/NVARCHAR2...

    This does not help either:

        protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
        {
            configurationBuilder.DefaultTypeMapping<string>().IsUnicode(false);
        }
    
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You should not change the migration file.

    ABP uses the standard EF Core API, and the migration file is generated by the oracle driver. unfortunately, we can't do anything

  • User Avatar
    0
    alexander.nikonov created

    Ok. But that was not my main question. My main question is why output generated by Devart differs from the standard one? They are supposed to be identical. Are you saying that output generated by standard driver is incorrect and cannot be used for Oracle migration??

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I'm not to say it can't used.

    My main question is why output generated by Devart differs from the standard one

    I think you can ask Devart, it has nothing to do with ABP.

  • User Avatar
    0
    alexander.nikonov created

    And again you don't understand what I'm trying to say. I'm telling you that migration using a standard driver causes problem now. I have shown you the fragments of the code. Migration with Devart which has always been used never caused the problem. But now Devart cannot be used, they delay the NET7 support for month or so. You have published ABP7, but rely on Devart. Can you offer a working migration solution NOW?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Sorry for the misunderstanding.

    You can try this:

    foreach (var property in builder.Model.GetEntityTypes().SelectMany(e => e.GetProperties()).Where(p => p.ClrType == typeof(string)))
    {
        property.SetIsUnicode(false);
    }
    
    foreach (var property in builder.Model.GetEntityTypes().SelectMany(e => e.GetProperties()).Where(p => p.ClrType == typeof(ExtraPropertyDictionary)))
    {
        property.SetIsUnicode(false);
    }
    

  • User Avatar
    0
    alexander.nikonov created

    p.ClrType == typeof(ExtraPropertyDictionary)

    That was it. I was checking against string type only, would not expect such ClrType. Seems like I finally got rid of NVARCHAR. Thank you. I will keep this ticket open for some time until the migration is done...

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    ok

Made with ❤️ on ABP v9.1.0-preview. Updated on November 26, 2024, 12:49