Is there going to be any EF Core ICollection<> support going forward with 11+? #3894
-
Currently there doesn't appear to be any solutions for EF Core mapping onto existing collections, as neither AutoMapper.Collections or AutoMapper.Collection.EntityFrameworkCore doesn't support v11 and no word on if it ever will. Situations such as the following don't work: var entity = _mapper.Map<MyModel, MyEntity>(model, entity); and require difficult CreateMap<MyModel, DataModel.MyEntity>()
.AfterMap(DontOverwriteMyCollections);
private void DontOverwriteMyCollections(MyModel from, DataModel.MyEntity to)
{
to.Id = from.Id;
var i = 0;
// no static Mapper.Map<>() available anymore, so this is tedious
foreach(var row in from.Relationship) {
var dest = to.Relationship.Skip(i).First();
dest.SubId = row.SubId;
// etc
}
} is there a.. better way? |
Beta Was this translation helpful? Give feedback.
Answered by
jbogard
Feb 11, 2022
Replies: 1 comment
-
Open a PR for those two to support v11 and latest EF Core? |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lbargaoanu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Open a PR for those two to support v11 and latest EF Core?