EF Core Power tools不会将多对多连接表的模型加载到ASP.NET Web API项目中。

huangapple go评论81阅读模式
英文:

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.

Models look like this:
EF Core Power tools不会将多对多连接表的模型加载到ASP.NET Web API项目中。

I got follwoing Models in my project.

EF Core Power tools不会将多对多连接表的模型加载到ASP.NET Web API项目中。

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.

Models look like this:
EF Core Power tools不会将多对多连接表的模型加载到ASP.NET Web API项目中。

I got follwoing Models in my project.

EF Core Power tools不会将多对多连接表的模型加载到ASP.NET Web API项目中。

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

huangapple
  • 本文由 发表于 2023年6月29日 17:02:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/76579592.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定