
[EFCore] Entity와 DB, Table 연동하기
·
공부/EFCore
public class ItemOption { public int Str { get; set; } public int Dex { get; set; } public int Hp { get; set; } } public class Item { public ItemOption Option { get; set; } // ... // } items[0].Option = new ItemOption() { Dex = 1, Hp = 2, Str = 3 }; 예시 상황이다. AppDbContext에 둘 중 하나를 추가해주면 된다. 1️⃣ OwnsOne builder.Entity() .OwnsOne(i => i.Option); 이를 추가해서 새로운 테이블을 만들면, Option_Str, Option_Dex, Option_..