문제

SubSonic SimpleRepository doesn't seem to have a lot of support for foreign relations. How can I have foreign relationships in my code models that persist and load from the database naturally?

도움이 되었습니까?

해결책

FKs are a DB concern - the Simple Repo is there to work as simply as possible so if you have a collection of child objects, you load them as needed:

public IEnumerable Kids{ get{ return Kids.All().Where(x=>x.ParentID==this.ID;
} }

You'd have to roll this by hand. If you want to "eager" load it - do on a case by case basis.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top