Issue dbcontext foreign key with include
When setting foreign key relation in dbcontext for an table to another table from second schema located in another dbcontext if using include in select return next exception (schema returned in exception is first schema not second schema, meaning it search for table in wrong first schema not second)
MySql.Data.MySqlClient.MySqlException: Table 'schema.table' doesn't exist
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable1.ConfiguredValueTaskAwaiter.GetResult()
at MySql.Data.MySqlClient.Results.ResultSet.2 parameterValues, Boolean closeConnection)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary2 parameterValues)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable.Enumerator.BufferlessMoveNext(Boolean buffer)
at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_ShapedQuery>d__31.MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.MySqlQueryingEnumerable1.MySqlEnumerator.MoveNext()
at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_Include>d__301.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__152.MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor1.EnumeratorExceptionInterceptor.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at App.Repository1.Get(Expression1 filter, Func2 orderBy, Expression1[] includeProperties, Nullable1 skip, Nullable1 take) in E:\Development\web\abatorizari\Repository\Repository.cs:line 69
at App.Services.PopulariService.GetPopulari(Expression1 filter) in E:\Development\web\abatorizari\Services\PopulariService.cs:line 46
at App.PopulariController.GetPopulariLuna(Int32 luna, Int32 an) in E:\Development\web\abatorizari\Controllers\PopulariController.cs:line 32
at lambda_method(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.
Further technical details
EF Core version: 1.1.0 (found in project.json or packages.config) Database Provider: (e.g. Microsoft.EntityFrameworkCore.MySql) Operating system: Windows 10 IDE: (e.g. Visual Studio Code)
Can you start by filing an issue with MySQL - https://dev.mysql.com/. If they isolate it to an underlying issue in EF Core, they will file the appropriate issue back with us.