Support forum for ASP.NET Zero (https://aspnetzero.com/).
By exlnt
#20780 I just repeated all my steps from 1 again. This time I added one very simple entity that has no FKs.
I tried to scaffold the migration for this table and ran into the error.

Here is my simple entity:
Code: Select all   public partial class InvCtry
    {
        public InvCtry()
        {
        }

        public string CtryIsoAlphaCd { get; set; }
        public string CtryNm { get; set; }
        public string CtrySrceCd { get; set; }
        public string EnblIn { get; set; }

    }
By exlnt
#20834
ismcagdas wrote:Hi @exlnt,

Can you also share the error message ?

Thanks.


It is the same one I posted in this thread and when I started this thread.
Code: Select allFATAL 2017-06-21 10:28:52,592 [1    ] Abp.AbpBootstrapper                      - System.InvalidOperationException: Unable to determine the relationship represented by navigation property 'User.DeleterUser' of type 'User'. Either manually configure the relationship, or ignore this property from the model.
   at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.PropertyMappingValidationConvention.Apply(InternalModelBuilder modelBuilder)
   at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.OnModelBuilt(InternalModelBuilder modelBuilder)
   at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)
User avatar
By alper
#21033 Hi,

I found the problem in your solution.
You have commented out base OnModelCreating, that's why migrations cannot be done correctly.
Code: Select all //base.OnModelCreating(modelBuilder);


Using the empty DbContext below will solve your problem ;) .

Code: Select all public class RemodelOpsDbContext : AbpZeroDbContext<Tenant, Role, User, RemodelOpsDbContext>
    {
        public RemodelOpsDbContext(DbContextOptions<RemodelOpsDbContext> options)
            : base(options)
        {

        }
    }
By exlnt
#21054
alper wrote:Hi,

I found the problem in your solution.
You have commented out base OnModelCreating, that's why migrations cannot be done correctly.
Code: Select all //base.OnModelCreating(modelBuilder);


Using the empty DbContext below will solve your problem ;) .

Code: Select all public class RemodelOpsDbContext : AbpZeroDbContext<Tenant, Role, User, RemodelOpsDbContext>
    {
        public RemodelOpsDbContext(DbContextOptions<RemodelOpsDbContext> options)
            : base(options)
        {

        }
    }


Thanks! That worked!