강의

멘토링

로드맵

Inflearn Community Q&A

No author

This post's author information has been deleted.

[MMORPG Game Development Series with C# and Unity] Part 8: Entity Framework Core

Relationship Config

Fluent API로 FK를 설정할 때 발생하는 에러

Written on

·

342

0

2022.05.06 기준

builder.Entity<Player>()

.HasMany(p => p.CreatedItems)

.WithOne(i => i.Creator)

.HasForeignKey(i => i.CreatorID)

 

강사님은 영상에서 Item DataModel의 int CreatorID만 Nullable로 설정하셔서 잘되었지만

똑같이 해보면 FK에서 에러가 발생합니다.

public Player Creator Property도 똑같이 Nullable로 설정해줘야 에러가 사라집니다.

 

원인을 잘 모르겠습니다....

 

ORMEF-Core

Answer 1

0

Rookiss님의 프로필 이미지
Rookiss
Instructor

이 부분은 버전 문제로 보입니다.
저도 3.0대로 작업하던걸 5.0대로 올리니 이전엔 잘 되던 것들이 막히는 경우가 꽤 있었습니다.

No author

This post's author information has been deleted.

Ask a question