1

Is there a way to have the EF Core Power Tools create setters for collections, like so:

class Parent
{
    // ...
    public virtual ICollection<Child> Children { get; } // Setter is missing
}

The setter would be extremely useful with AutoMapper. Otherwise we have to explicitly specify the mapping like this.

TravelingFox
  • 484
  • 5
  • 18
  • That's not needed in newer AM versions. – Lucian Bargaoanu Feb 20 '23 at 10:54
  • @LucianBargaoanu We're using AutoMapper.Collection.EntityFrameworkCore 9.0.0, AutoMapper 12.0.0, AutoMapper.Extensions.Microsoft.DependencyInjection 12.0.0. I see there's an AutoMapper 12.0.1 package available now, but you wrote "newer AM versions", so that shouldn't be causing this? The properties aren't mapped. – TravelingFox Feb 20 '23 at 12:18
  • A repro would help. Make a [gist](https://gist.github.com/lbargaoanu/9c7233441c3a3413cc2b9b9ebb5964a9) that we can execute and see fail. – Lucian Bargaoanu Feb 20 '23 at 12:39
  • 1
    @LucianBargaoanu I see you're a LINQPad user as well. ;) I just tried to reproduce this issue in LINQPad, but couldn't. But without the setters, we're getting empty collections in our application. I'll try to figure out what's causing this and provide sample code to reproduce the problem. – TravelingFox Feb 20 '23 at 15:33

0 Answers0