Ao invés de deixar somente o campo ID no ReadDto, incluí Filme e Cinema, o que gera referências circulares mais pra frente quando as listagem de filme e cinema deveriam mostrar as sessões também, o problema é que mesmo depois de comentar estes campos, fazer remove-migrations, make-migrations, drop-database, update-database continua dando erro na GET /filme. Parece que FilmeContextModelSnapshop permaneceu inalterado mesmo com as re-migrations. Rodando o projeto baixado do github funciona normal. Vou usando este até terminar...
AutoMapper.AutoMapperMappingException: Error mapping types.
Mapping types:
EntityQueryable1 -> List
1
Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable1[[FilmesAPI.Models.Filme, FilmesAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] -> System.Collections.Generic.List
1[[FilmesAPI.Data.Dtos.ReadFilmeDto, FilmesAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]
---> AutoMapper.AutoMapperMappingException: Error mapping types.
Mapping types: Filme -> ReadFilmeDto FilmesAPI.Models.Filme -> FilmesAPI.Data.Dtos.ReadFilmeDto
Type Map configuration: Filme -> ReadFilmeDto FilmesAPI.Models.Filme -> FilmesAPI.Data.Dtos.ReadFilmeDto
Destination Member: Sessoes
---> System.InvalidOperationException: This MySqlConnection is already in use. See https://fl.vu/mysql-conn-reuse
at MySqlConnector.Core.ServerSession.StartQuerying(ICancellableCommand command) in /_/src/MySqlConnector/Core/ServerSession.cs:line 283
at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(IReadOnlyList1 commands, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/CommandExecutor.cs:line 50 at MySqlConnector.MySqlCommand.ExecuteReaderAsync(CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 344 at MySqlConnector.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior) in /_/src/MySqlConnector/MySqlCommand.cs:line 278 at System.Data.Common.DbCommand.ExecuteReader() at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable
1.Enumerator.InitializeReader(Enumerator enumerator)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.Enumerator.<>c.<MoveNext>b__21_0(DbContext _, Enumerator enumerator) at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlExecutionStrategy.Execute[TState,TResult](TState state, Func
3 operation, Func3 verifySucceeded) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable
1.Enumerator.MoveNext()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.Load[TSource](IQueryable1 source) at Microsoft.EntityFrameworkCore.Internal.EntityFinder
1.Load(INavigation navigation, InternalEntityEntry entry)
at Microsoft.EntityFrameworkCore.Internal.EntityFinderCollectionLoaderAdapter.Load(InternalEntityEntry entry)
at Microsoft.EntityFrameworkCore.ChangeTracking.CollectionEntry.Load()
at Microsoft.EntityFrameworkCore.Infrastructure.Internal.LazyLoader.Load(Object entity, String navigationName)
at Microsoft.EntityFrameworkCore.Proxies.Internal.LazyLoadingInterceptor.Intercept(IInvocation invocation)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.FilmeProxy.get_sessoes()
at lambda_method8(Closure , Object , List1 , ResolutionContext ) --- End of inner exception stack trace --- at lambda_method8(Closure , Object , List
1 , ResolutionContext )
--- End of inner exception stack trace ---
at lambda_method8(Closure , Object , List`1 , ResolutionContext )
at FilmesAPI.Controllers.FilmeController.RecuperaFilmes(Int32 skip, Int32 take) in