Replies: 2 comments
|
The following does not work either -probably not an ThingModel[] things = (await dataClassesContext.Things.OrderBy(t => t.Id).AsNoTracking().Select
(
t => new ThingModel
{
ProductName = t.ProductName,
Id = t.Id,
CategoryID = t.CategoryID,
SupplierID = t.SupplierID,
Category = new CategoryModel
{
CategoryID = t.Category.CategoryID,
CategoryName = t.Category.CategoryName
},
SupplierAddress = new AddressModel
{
AddressID = t.SupplierAddress.AddressID,
City = t.SupplierAddress.City
},
AlternateAddresses = t.AlternateAddresses == null ? new AlternateAddressModel[0] : t.AlternateAddresses.Select(a => new AlternateAddressModel
{
AlternateAddressID = a.AlternateAddressID,
City = a.City,
State = a.State,
ZipCode = a.ZipCode
}).ToList()
}
).OrderBy(t => t.ProductName).ToListAsync(CancellationToken.None)).ToArray();
`` |
0 replies
|
We don't test our LINQ expressions on our providers (only EF Core). In general, you'll need to test the LINQ query by itself, without AutoMapper, to see if it works. That's how we built out the current support - verified LINQ queries, then generated them. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Is it possible to expand an owned Cosmos DB list using ProjectTo? e.g.
modelBuilder.Entity<Thing>().OwnsMany(t => t.AlternateAddresses);Configuration below:
Please find a repro here. The results are the same using
Testcontainers.CosmosDbor using an Azure resource. TheOwnsOneexpansions needed a workaround in the configuration. TheOwnsManyattempt doesn't quite work. Oddly, theAlternateAddressessource collection seems to be null inForMemberhandler. Known issues?All reactions