'.NET Core Entity Framework how to map nested class into one sql table
I'm still new to .NET Core. I have this character that I want to store in SQLite using an entity.
But by default, Character
, CharacterData
and CharacterLine
are mapped to different tables.
Is there anyways to make entity map them to the same table?
public class Character
{
public int CharacterID { get; set; }
public string characterName { get; set; }
public string characterDisplayName { get; set; }
public string characterIconPath { get; set; }
public CharacterData characterInfo { get; set; }
}
public class CharacterData
{
public int CharacterDataID { get; set; }
public Gender Gender { get; set; }
public int Height { get; set; }
public DateTime BirthDay { get; set; }
public CharacterLine lines { get; set; }
}
public class CharacterLine
{
public int CharacterLineID { get; set; }
public string line1 { get; set; }
public string line2 { get; set; }
public string line3 { get; set; }
public string line4 { get; set; }
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|