I posted this [https://forum.aspnetboilerplate.com/viewtopic.php?f=2&t=9090]) the other day. Today I downloaded the .Net Core 1.1 template again and added just a couple of entity classes. Soon as the migration is scaffolded or the app is run the error appears. Has anyone else run into this issue?
17 Answer(s)
-
0
I am unable to get past this error. Can someone from the support team please help here?
-
0
Can someone from support please respond here. I have tried two template downloads and I keep getting this error. My project is not able to move forward.
-
0
I have emailed a link to my solution for you to review the error. I could not respond on the original thread as it has been locked.
Thanks!
-
0
I just replicated the problem with a fresh template download just now.
Steps:
- Download .Net Core 1.1 MVC template from ABP site.
- Open solution and add connection string
- Set Migrator project as startup project
- Run solution, allow migrator to create host and tenant DB
- Run app, all normal, ABP default site opens and works normally
- Add custom entity into MyProject.Core project
- Add custom entity DBSet entry into context file in MyProject.EntityFrameworkCore project
- Run the application - You get error, app does not load.
- Try to add migration for the custom entities - You get error, migration NOT created.
- Remove all references to custom entities from context file in MyProject.EntityFrameworkCore project
- Run app - You get error, app does not load
Here is the complete error message.
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) at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel() at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value() at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.<RealizeService>b__0(ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServiceCollectionExtensions.<>c.<AddQuery>b__1_3(IServiceProvider p) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.<RealizeService>b__0(ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider) at Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService[TService](IInfrastructure`1 accessor) at Microsoft.EntityFrameworkCore.DbContext.get_QueryProvider() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.<.ctor>b__3_0() at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.System.Linq.IQueryable.get_Provider() at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source, Expression`1 predicate) at Exlnt.RemodelOps.EntityFrameworkCore.Seed.Host.DefaultEditionCreator.CreateEditions() in D:\VisualStudioOnline\RemodelOps\src\Exlnt.RemodelOps.EntityFrameworkCore\EntityFrameworkCore\Seed\Host\DefaultEditionCreator.cs:line 24 at Exlnt.RemodelOps.EntityFrameworkCore.Seed.Host.DefaultEditionCreator.Create() in D:\VisualStudioOnline\RemodelOps\src\Exlnt.RemodelOps.EntityFrameworkCore\EntityFrameworkCore\Seed\Host\DefaultEditionCreator.cs:line 19 at Exlnt.RemodelOps.EntityFrameworkCore.Seed.Host.InitialHostDbBuilder.Create() in D:\VisualStudioOnline\RemodelOps\src\Exlnt.RemodelOps.EntityFrameworkCore\EntityFrameworkCore\Seed\Host\InitialHostDbBuilder.cs:line 14 at Exlnt.RemodelOps.EntityFrameworkCore.Seed.SeedHelper.SeedHostDb(RemodelOpsDbContext context) in D:\VisualStudioOnline\RemodelOps\src\Exlnt.RemodelOps.EntityFrameworkCore\EntityFrameworkCore\Seed\SeedHelper.cs:line 25 at Exlnt.RemodelOps.EntityFrameworkCore.Seed.SeedHelper.WithDbContext[TDbContext](IIocResolver iocResolver, Action`1 contextAction) in D:\VisualStudioOnline\RemodelOps\src\Exlnt.RemodelOps.EntityFrameworkCore\EntityFrameworkCore\Seed\SeedHelper.cs:line 41 at Exlnt.RemodelOps.EntityFrameworkCore.Seed.SeedHelper.SeedHostDb(IIocResolver iocResolver) in D:\VisualStudioOnline\RemodelOps\src\Exlnt.RemodelOps.EntityFrameworkCore\EntityFrameworkCore\Seed\SeedHelper.cs:line 17 at Exlnt.RemodelOps.EntityFrameworkCore.RemodelOpsEntityFrameworkModule.PostInitialize() in D:\VisualStudioOnline\RemodelOps\src\Exlnt.RemodelOps.EntityFrameworkCore\EntityFrameworkCore\RemodelOpsEntityFrameworkModule.cs:line 40 at System.Collections.Generic.List`1.ForEach(Action`1 action) at Abp.AbpBootstrapper.Initialize() at Abp.AspNetCore.AbpApplicationBuilderExtensions.UseAbp(IApplicationBuilder app, Action`1 optionsAction) at Exlnt.RemodelOps.Web.Startup.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in D:\VisualStudioOnline\RemodelOps\src\Exlnt.RemodelOps.Web.Mvc\Startup\Startup.cs:line 56 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app) at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
I did one more test.
- I removed all my custom entities from the dbContext file.
- I add one simple entity with just 3 properties and then added that to dbContext file.
- Ran add-migration cmd via pkg manager console and still the same error is reported. Basically the minute I introduce any type of custom entity in the solution the error comes up, during add migration or in the browser when you run the app.
-
0
Hi,
Thank you for detailed explanation and sorry for the late response. We will try your scenario and try to fix this problem as soon as possible.
Thanks.
-
0
@ismcagdas - Thank you very much!
One other issue I am having on this same template is with the localization function "L". I copied the tenant index view and just updated the fields for my custom entity. On my new copied page I keep getting error "L does not exist in this context" I have all the same using statements and my controller inherits from the same base controller. My page, controller and views are all located in the Areas/App/ folder structure.
-
0
I tried again with my template this morning and no matter what kind of custom entity I add into the solution I keep getting the same error.
DEBUG 2017-06-21 10:28:50,191 [1 ] Abp.AutoMapper.AbpAutoMapperModule - MyCo.MyApp.Web.Views.Shared.Components.TenantChange.TenantChangeViewModel FATAL 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) at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel() at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value() at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.<RealizeService>b__0(ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServiceCollectionExtensions.<>c.<AddQuery>b__1_3(IServiceProvider p) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.<RealizeService>b__0(ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider) at Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService[TService](IInfrastructure`1 accessor) at Microsoft.EntityFrameworkCore.DbContext.get_QueryProvider() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.<.ctor>b__3_0() at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.System.Linq.IQueryable.get_Provider() at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source, Expression`1 predicate) at MyCo.MyApp.EntityFrameworkCore.Seed.Host.DefaultEditionCreator.CreateEditions() in C:\GIT-MyApp-RA5\MyApp-.net-core\MyCo.MyDept.MyApp\src\MyCo.MyApp.EntityFrameworkCore\EntityFrameworkCore\Seed\Host\DefaultEditionCreator.cs:line 24 at MyCo.MyApp.EntityFrameworkCore.Seed.Host.DefaultEditionCreator.Create() in C:\GIT-MyApp-RA5\MyApp-.net-core\MyCo.MyDept.MyApp\src\MyCo.MyApp.EntityFrameworkCore\EntityFrameworkCore\Seed\Host\DefaultEditionCreator.cs:line 19 at MyCo.MyApp.EntityFrameworkCore.Seed.Host.InitialHostDbBuilder.Create() in C:\GIT-MyApp-RA5\MyApp-.net-core\MyCo.MyDept.MyApp\src\MyCo.MyApp.EntityFrameworkCore\EntityFrameworkCore\Seed\Host\InitialHostDbBuilder.cs:line 14 at MyCo.MyApp.EntityFrameworkCore.Seed.SeedHelper.SeedHostDb(MyAppDbContext context) in C:\GIT-MyApp-RA5\MyApp-.net-core\MyCo.MyDept.MyApp\src\MyCo.MyApp.EntityFrameworkCore\EntityFrameworkCore\Seed\SeedHelper.cs:line 25 at MyCo.MyApp.EntityFrameworkCore.Seed.SeedHelper.WithDbContext[TDbContext](IIocResolver iocResolver, Action`1 contextAction) in C:\GIT-MyApp-RA5\MyApp-.net-core\MyCo.MyDept.MyApp\src\MyCo.MyApp.EntityFrameworkCore\EntityFrameworkCore\Seed\SeedHelper.cs:line 41 at MyCo.MyApp.EntityFrameworkCore.Seed.SeedHelper.SeedHostDb(IIocResolver iocResolver) in C:\GIT-MyApp-RA5\MyApp-.net-core\MyCo.MyDept.MyApp\src\MyCo.MyApp.EntityFrameworkCore\EntityFrameworkCore\Seed\SeedHelper.cs:line 17 at MyCo.MyApp.EntityFrameworkCore.MyAppEntityFrameworkModule.PostInitialize() in C:\GIT-MyApp-RA5\MyApp-.net-core\MyCo.MyDept.MyApp\src\MyCo.MyApp.EntityFrameworkCore\EntityFrameworkCore\MyAppEntityFrameworkModule.cs:line 40 at System.Collections.Generic.List`1.ForEach(Action`1 action) at Abp.AbpBootstrapper.Initialize()
I took the error text from the log file this time and it seems to be pointing to the tenant view model?
MyCo.MyApp.Web.Views.Shared.Components.TenantChange.TenantChangeViewModel
-
0
<cite>exlnt: </cite> I just replicated the problem with a fresh template download just now.
Steps:
- Download .Net Core 1.1 MVC template from ABP site.
- Open solution and add connection string
- Set Migrator project as startup project
- Run solution, allow migrator to create host and tenant DB
- Run app, all normal, ABP default site opens and works normally
- Add custom entity into MyProject.Core project
- Add custom entity DBSet entry into context file in MyProject.EntityFrameworkCore project
- Run the application - You get error, app does not load.
- Try to add migration for the custom entities - You get error, migration NOT created.
- Remove all references to custom entities from context file in MyProject.EntityFrameworkCore project
- Run app - You get error, app does not load
- At step 8, application should work without update-database (if there is no any db operation about custom entity).
- Before step-8, are you getting any compile time errors?
- And one last thing, could you share your customentity that you added?
-
0
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:
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; } }
-
0
Hi @exlnt,
Can you also share the error message ?
Thanks.
-
0
<cite>ismcagdas: </cite> 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.
FATAL 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)
-
0
@Support - Any updates on this issue, have you had a chance to reproduce the error or look at the solution I shared with you?
-
0
Hi,
I tried to download your solution from Drive but it lasts very long time for Google Drive to zip and serve the file. So what i want from you is; zip the solution folder and send the link to <a href="mailto:[email protected]">[email protected]</a>
-
0
Hi,
I found the problem in your solution. You have commented out base OnModelCreating, that's why migrations cannot be done correctly.
//base.OnModelCreating(modelBuilder);
Using the empty DbContext below will solve your problem ;) .
public class RemodelOpsDbContext : AbpZeroDbContext<Tenant, Role, User, RemodelOpsDbContext> { public RemodelOpsDbContext(DbContextOptions<RemodelOpsDbContext> options) : base(options) { } }
-
0
<cite>alper: </cite> Hi,
I found the problem in your solution. You have commented out base OnModelCreating, that's why migrations cannot be done correctly.
//base.OnModelCreating(modelBuilder);
Using the empty DbContext below will solve your problem ;) .
public class RemodelOpsDbContext : AbpZeroDbContext<Tenant, Role, User, RemodelOpsDbContext> { public RemodelOpsDbContext(DbContextOptions<RemodelOpsDbContext> options) : base(options) { } }
Thanks! That worked!
-
0
You are wellcome.