marcialwushu / AspNetCoreAPI

:book: Curso criando aplicativos com Ionic 3 e Apis em AspNet Core usando DDD
1 stars 1 forks source link

Error: Bad Request #6

Open marcialwushu opened 4 years ago

marcialwushu commented 4 years ago
{
  "errors": "No suitable constructor found for entity type 'Canal'. 
The following parameters could not be bound to properties of the entity: 'usuario'.",
  "exception": "System.InvalidOperationException: No suitable constructor found for entity type 'Canal'. 
The following parameters could not be bound to properties of the entity: 'usuario'.\r\n   at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConstructorBindingConvention.Apply(InternalModelBuilder modelBuilder)\r\n   at 
Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ImmediateConventionScope.OnModelBuilt(InternalModelBuilder modelBuilder)\r\n   at 
Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.OnModelBuilt(InternalModelBuilder modelBuilder)\r\n   at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.Validate()\r\n   at 
Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)\r\n   at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.<>c__DisplayClass5_0.<GetModel>b__1()\r\n   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Lazy`1.CreateValue()\r\n   at 
Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)\r\n   at 
Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel()\r\n   at 
Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()\r\n   at 
Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.<TryAddCoreServices>b__7_1(IServiceProvider p)\r\n   at lambda_method(Closure , ServiceProviderEngineScope )\r\n   at 
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)\r\n   at 
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)\r\n   at 
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)\r\n   at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()\r\n   at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()\r\n   at 
Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()\r\n   at Microsoft.EntityFrameworkCore.DbContext.EntryWithoutDetectChanges[TEntity](TEntity entity)\r\n   at Microsoft.EntityFrameworkCore.DbContext.SetEntityState[TEntity](TEntity entity, EntityState entityState)\r\n   at Microsoft.EntityFrameworkCore.DbContext.Add[TEntity](TEntity entity)\r\n   at 
Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.Add(TEntity entity)\r\n   at 
YouLearn.Infra.Persistence.Repositories.RepositoryUsuario.Salvar(Usuario usuario) in C:\\Users\\cleilson\\Documents\\Workspace\\GITHUB\\AspNetCoreAPI\\YouLearn.Infra\\Persistence\\Repositories\\RepositoryUsuario.cs:line 37\r\n   at YouLearn.Domain.Services.ServiceUsuario.AdicionarUsuario(AdicionarUsuarioRequest request) in C:\\Users\\cleilson\\Documents\\Workspace\\GITHUB\\AspNetCoreAPI\\YouLearn.Domain\\Services\\ServiceUsuario.cs:line 48\r\n   at YouLearn.Api.Controllers.UsuarioController.Adicionar(AdicionarUsuarioRequest request) in C:\\Users\\cleilson\\Documents\\Workspace\\GITHUB\\AspNetCoreAPI\\YouLearn.Api\\Controllers\\UsuarioController.cs:line 35"
}
marcialwushu commented 4 years ago
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 POST http://localhost:50754/api/v1/Usuario/Adicionar application/json 114
Microsoft.AspNetCore.Cors.Infrastructure.CorsService:Information: Policy execution successful.
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Route matched with {action = "Adicionar", controller = "Usuario"}. Executing controller action with signature Microsoft.AspNetCore.Mvc.IActionResult Adicionar(YouLearn.Domain.Arguments.Usuario.AdicionarUsuarioRequest) on controller YouLearn.Api.Controllers.UsuarioController (YouLearn.Api).
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executing action method YouLearn.Api.Controllers.UsuarioController.Adicionar (YouLearn.Api) - Validation state: Valid
Exceção gerada: 'System.InvalidOperationException' em System.Private.CoreLib.dll
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executed action method YouLearn.Api.Controllers.UsuarioController.Adicionar (YouLearn.Api), returned result Microsoft.AspNetCore.Mvc.BadRequestObjectResult in 63.0364ms.
Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor:Information: Executing ObjectResult, writing value of type '<>f__AnonymousType1`2[[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'.
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executed action YouLearn.Api.Controllers.UsuarioController.Adicionar (YouLearn.Api) in 81.3165ms
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 114.2206ms 400 application/json; charset=utf-8
O thread 0x2a1c foi fechado com o código 0 (0x0).