question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Translation skipped for array accessed by relationship

See original GitHub issue

While operation translations for simple types on owned entities are working well, array operations aren’t getting translated into sql query.

public class Entity
{
    public int Id { get; set; }
    public OwnedEntity OwnedEntity { get; set; }
}

public class OwnedEntity
{
    public int[] Array { get; set; }
}

Configuration:

modelBuilder.Entity<Entity>(
  builder =>
  {
    builder.HasKey(s => s.Id);
    builder.OwnsOne(
      s => s.OwnedEntity,
      ownershipBuilder =>
      {
        ownershipBuilder
          .Property(entity => entity.Array)
          .IsRequired();
      });
  });

LINQ:

context.Set<Entity>()
  .Where(s => s.OwnedEntity.Array.Contains(1))
  .ToList();

Actual sql query:

SELECT s."Id", s."Id", s."OwnedEntity_Array"
FROM "Entity" AS s

Expected sql query:

SELECT s."Id", s."OwnedEntity_Array"
FROM "Entity" AS s
WHERE 1 = ANY (s."OwnedEntity_Array") = TRUE

Actual for: Npgsql.EntityFrameworkCore.PostgreSQL v2.2.0-preview1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
austindrenskicommented, Nov 17, 2018

Yes, still interested… I need to wrap up a few more issues for 2.2 first, then I’ll give this a look. It may also be worth waiting for #541 to merge, since that has an effect on how array translations evaluate.

0reactions
austindrenskicommented, Dec 6, 2018

Sounds good to me, closing for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Skip and Take to pick up alternate items in an array
I have a string array with the following items: ... After the Skip then Take it returns 1 item in it so it...
Read more >
Translation | Django documentation
translation (easily recognizable by the lazy suffix in their names) to translate strings lazily – when the value is accessed rather than when...
Read more >
6 Native Format Builder Wizard
This chapter describes the Native Format Builder wizard, which enables you to create native schemas used for translation. It includes use cases and...
Read more >
Schema and data type mapping in copy activity
For records where the array marked as collection reference is empty and the check box is selected, the entire record is skipped. Map ......
Read more >
translate() - CSS: Cascading Style Sheets - MDN Web Docs
The translate() CSS function repositions an element in the horizontal and/or vertical directions. Its result is a data type.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found