When I map one of my object to the dto I get a stackoverflow exception. This is because I am using a self referencing object. Fortunately automapper allows setting a configuration in startup.cs to prevent that behaviour.
//MVC
services.AddMvc(options =>
{
options.Filters.Add(new CorsAuthorizationFilterFactory(DefaultCorsPolicyName));
}).AddJsonOptions(opt =>
{
opt.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Serialize;
});
But as I still get the stackoverflow exception after setting the option I guess that in ABP I have to configure that somewhere else. Where?
the answer can be found here: <a class="postlink" href="http://stackoverflow.com/questions/43192276/unhandled-exception-when-creating-new-migration-with-ef-6/">http://stackoverflow.com/questions/4319 ... with-ef-6/</a>
I am using the new angular 2 / asp.net core project with VS 2017 update 1 . After I have added some new entities I wanted to create a new migration as described in the documentation with the following command:
dotnet ef migrations add "created_new_BM_entities"
Unfortunately the dotnet-ef.exe crashes with the following exception:
PM> dotnet ef migrations add "created_new_BM_entities"
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.
enio.Web_Manager.Core -> D:\enio_git\bm.WebHub\aspnet-core\src\enio.Web_Manager.Core\bin\Debug\net461\enio.Web_Manager.Core.dll
enio.Web_Manager.EntityFramework -> D:\enio_git\bm.WebHub\aspnet-core\src\enio.Web_Manager.EntityFramework\bin\Debug\net461\enio.Web_Manager.EntityFramework.exe
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:02.32
Unbehandelte Ausnahme: System.InvalidOperationException: Could not invoke tool dotnet-ef.
bei Microsoft.Extensions.Internal.DotnetToolDispatcher.EnsureValidDispatchRecipient(String[]& programArgs, String toolName)
bei Migrator.EF6.Tools.Program.Main(String[] args)
Can you please explain what I am doing wrong here?
kind regards, marco
Hi,
when I run the Migrator project to create a new Migration I'll get an AutomaticMigrationsDisabledException. And the message is: Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration.
In another post I have seen that I would make sense now to run the database update command in the package manager console. But when I run Update-Database I get again an error: No DbContext was found in assembly 'enio.Web_Manager.EntityFramework'. Ensure that you're using the correct assembly and that the type is neither abstract nor generic.
Btw, I have selected EntityFramework as my Default project in the drop down list. What is also a bit strange is that I also receive the following message:
Both Entity Framework Core and Entity Framework 6 are installed. The Entity Framework Core tools are running. Use 'EntityFramework\Update-Database' for Entity Framework 6.
When I try executing EntityFramework\Update-Database I get the following exception: The EntityFramework package is not installed on project 'enio.Web_Manager.EntityFramework'.
Can you please give me an idea where to look for a solution? Do I have to use the commands for Entity Framework Core or Entity Framework 6 ?