英文:
EF Core Power tools does not load models of many to many junction table into asp.net wep api project
问题
I am loading 6 different models from SQL-Server-Management-Studio via EF Core Powertools into my web api project.
I got follwoing Models in my project.
I want to add a picture with the list of tags and categories like this.
var picture = new PressPicPicture
{
Image = bytes,
CreatedAt = request.CreatedAt,
CreatedBy = request.CreatedBy
};
await _pictureRepository.AddPicture(picture, cancellationToken);
foreach (var catId in request.CategoryIds)
{
var picutureCategory = new PressPicPictureCategories
{
IdPicture = picture.Id,
IdCat = catId
};
await picutureCategory.AddPictureTag(picutureCategory, cancellationToken);
}
My problem is that i cant access the PressPicPictureCategories Model because i dont get it into my project with EF-Core-Powertools 6. So my question is: Is there a way to solve this?
[1]: https://i.stack.imgur.com/sE3Oh.png
[2]: https://i.stack.imgur.com/1PHe2.png
英文:
I am loading 6 different models from SQL-Server-Management-Studio via EF Core Powertools into my web api project.
I got follwoing Models in my project.
I want to add a picture with the list of tags and categories like this.
var picture = new PressPicPicture
{
Image = bytes,
CreatedAt = request.CreatedAt,
CreatedBy = request.CreatedBy
};
await _pictureRepository.AddPicture(picture, cancellationToken);
foreach (var catId in request.CategoryIds)
{
var picutureCategory = new PressPicPictureCategories
{
IdPicture = picture.Id,
IdCat = catId
};
await picutureCategory.AddPictureTag(picutureCategory, cancellationToken);
}
My problem is that i cant access the PressPicPictureCategories Model because i dont get it into my project with EF-Core-Powertools 6. So my question is: Is there a way to solve this?
答案1
得分: 1
已解决!选项/高级 --> 使用多对多关系
英文:
Solved it! Options/Advanced --> use many to many relations
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论