Open Closed

ABP Upgrade 1.5 --> 2.0.1 - Build Error #3023


0
exlnt created

I just updated all the NuGet packages for ABP in my solution to version 2.0.1. My solution was running on 1.5.0.0. After the update, when I build the solution I get one error on the TenantManager.cs file in the .Core project. [attachment=0:z9cezoi6]Screenshot (65).png[/attachment:z9cezoi6]

Error:

Error	CS1503	Argument 1: cannot convert from 'void' to 'Microsoft.AspNet.Identity.IdentityResult'	EXLNT.NursingOps17.Core	\EXLNT.NursingOps17_VS2017\EXLNT.NursingOps17.Core\MultiTenancy\TenantManager.cs	80


15 Answer(s)
  • 0
    alirizaadiyahsi created

    Hi,

    In latest ABP CreateAsync(tenant) method type is void, so if you remove the CheckErrors, it works.

  • 0
    exlnt created

    This method is called in 12 other places. Do we need to update all of them and remove CheckErrors() ? [attachment=0:1gukf23j]Screenshot (66).png[/attachment:1gukf23j]

  • 0
    alirizaadiyahsi created

    Hi,

    Remove only lines that give errors.

  • 0
    exlnt created

    I updated to ABP version 2.0.2 today and now several of my entity index views are breaking. The logs are showing the error below.

    ERROR 2017-04-26 19:15:22,660 [10   ] nHandling.AbpApiExceptionFilterAttribute - An error occurred while preparing the command definition. See the inner exception for details.
    System.Data.Entity.Core.EntityCommandCompilationException: An error occurred while preparing the command definition. See the inner exception for details. ---> System.ApplicationException: FK Constriant not found for association 'EXLNT.NursingOps17.EntityFramework.FundingSource_Company' - must directly specify foreign keys on model to be able to apply this filter
    

    Do I need to downgrade my version of EntityFramework.DynamicFilters to 1.6?

  • 0
    alirizaadiyahsi created

    Hi,

    Check this #2051

  • 0
    exlnt created

    I have a couple of further questions on this issue.

    I started making the change mentioned on the other thread you shared, with respect to defining the FK in ModelBuilder code.

    I tested this for one of my entities that is reporting the error message. I then ran add-migration for the change in the EF project. When the migration is scripted I am seeing all the ABP upgrade related changes, along with ALL my custom tables.

    Question 1: When I perform an ABP upgrade, is it my responsibility to run add-migration cmd to generate the migrations needed due to the upgrade being done?

    Question 2: Why are all my tables getting put into this migration script, when I only changed one table?

    Thanks!

  • 0
    exlnt created

    I am redoing the upgrade to 4.0, using the steps given here: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/issues/96">https://github.com/aspnetzero/aspnet-zero/issues/96</a> I downloaded the 4.0 version of my solution from ASPNETZERO account downloads page. I placed this code into a new branch as-is. I then merged that branch of code into my working copy. I then updated all of the NuGet packages for ABP to 2.0.2. All of the projects are compiling just fine, all errors have been resolved. I am trying to run the migrator app to apply all the migrations to the DB. As soon as it runs, it crashes with the following error.

    System.IO.FileLoadException: Could not load file or assembly 'log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
    

    I did a google search and tried a couple of the solutions others used, but it did not fix the issue. How can I resolve this?

  • 0
    exlnt created

    I resolved the migrator tool error, by updating the entire project code with that taken from v4.0.

    However, now when I run it, one of the migrations, for ABP, is failing.

    namespace EXLNT.NursingOps17.Migrations
    {
        using System;
        using System.Data.Entity.Migrations;
        
        public partial class Added_Tenant_UI_Customization_Properties : DbMigration
        {
            public override void Up()
            {
                AddColumn("dbo.AbpTenants", "CustomCssId", c => c.Guid());
                AddColumn("dbo.AbpTenants", "LogoId", c => c.Guid());
                AddColumn("dbo.AbpTenants", "LogoFileType", c => c.String(maxLength: 64));
            }
            
            public override void Down()
            {
                DropColumn("dbo.AbpTenants", "LogoFileType");
                DropColumn("dbo.AbpTenants", "LogoId");
                DropColumn("dbo.AbpTenants", "CustomCssId");
            }
        }
    }
    

    When I look at the migration history in my DB, this migration has already been applied, see below. [attachment=0:1gv2jm94]Screenshot (79).png[/attachment:1gv2jm94]

    Yet when I try to perform "Add-Migration" cmd, it creates a migration with exact same changes as shown in the above migration. Yet when I issue the update-database cmd it fails with the error message shown below.

    System.Data.SqlClient.SqlException (0x80131904): Column names in each table must be unique. Column name 'CustomCssId' in table 'dbo.AbpTenants' is specified more than once.
    

  • 0
    ismcagdas created
    Support Team

    Hi,

    Ef and Ef Core uses different database tables for migrations. table __MigrationHistory is deleted and EF Core uses __EFMigrationsHistory table.

    But what I didn't understand, why it didn't give an error for first migration. Can you also create a new database with a new connection string using your migrations ?

  • 0
    exlnt created

    In my db i do not see the new migration table you are referring to, I only see the old one.

    I can create a new DB on my local desktop, that is NOT an issue.

    However, my concern about this upgrade process relates to how I would manage this for my "production" environment. I would not be in an position to delete my prod DB and create a new one. Therefore I need to get this upgrade to work on local on my existing DB first.

  • 0
    ismcagdas created
    Support Team

    Hi,

    Latest version of AspNet Zero uses EF core and Identity Core. If you want to use them in your project as well, you have to handle this data migration. You can search on the web about this. If this is not crutial for you I suggest you not to use EF core. It is more suitable for new projects.

  • 0
    exlnt created

    I am using the MVC/JQuery template for V4.0. Has that template also been changed to use EF Core?

  • 0
    hikalkan created
    Support Team

    Hi,

    Just fixing @ismcagdas's response. As I understand, you are still using ASP.NET MVC 5.x + jQuery (not ASP.NET Core). In that case, you will still use EF 6.x, it's not changed.

    In general, when you want to merge AspNet Zero's latest changes to your solution, you should not merge migrations. Instead, after dbcontext & entity changes, just add a new migration.

  • 0
    exlnt created

    <cite>hikalkan: </cite> Hi,

    Just fixing @ismcagdas's response. As I understand, you are still using ASP.NET MVC 5.x + jQuery (not ASP.NET Core). In that case, you will still use EF 6.x, it's not changed.

    In general, when you want to merge AspNet Zero's latest changes to your solution, you should not merge migrations. Instead, after dbcontext & entity changes, just add a new migration.

    Ok, I think I get what you are saying, but just want to confirm. After I complete the merge method for all code to V4.0, I should just perform an add-migration to cover ALL migrations for prior release and make that my "initial" migration for my V4.0 based solution, correct?

  • 0
    hikalkan created
    Support Team

    Yes, it's like that. Your add-migration command will bring all changes.