0

I am loading 6 different models from SQL-Server-Management-Studio via EF Core Powertools into my web api project.

Models look like this: Table Diagram

I got follwoing Models in my project.

Models

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?

flomue99
  • 87
  • 9

1 Answers1

1

Solved it! Options/Advanced --> use many to many relations

flomue99
  • 87
  • 9
  • You are very welcome! – ErikEJ Jun 29 '23 at 13:34
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 02 '23 at 09:48