G
G
GineTik2021-08-15 12:02:46
C++ / C#
GineTik, 2021-08-15 12:02:46

Loading related data does not work, how to solve?

I have code

// подключил
using IslandCity.Models;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using IslandCity.App_Data;
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
using Microsoft.EntityFrameworkCore;


User user = db.Users
                .Include(context => context.Lands)
                     .ThenInclude(land => land.Card)
                .Include(context => context.Cards)
                .FirstOrDefault(u => u.Name == accountName);


but land.Card == null although it shouldn't,

why and how to fix it?
I will be grateful for any answer!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question