Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

142
Vistas
Mapping .Net Core Entities with One to Many relationship to Angular 2 interfaces

I'm creating a simple Blog using .Net Core C# and Angular 2.

Retrieving all the Posts worked fine, but I have now added an Array of Comments to each post and this has caused the following error:

enter image description here

Does TypeScript need more information about the comments?

Angular component:

enter image description here

API Method:enter image description here

9 months ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I've managed to fix the problem.

Due to the circular reference inside of Entity Framework the JSON failed to parse.

I manged to fix it by adding this option inside the startup.cs:

 services.AddMvc()
            .AddJsonOptions(options =>
            {
                options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
            });
9 months ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos