-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entity type with navigation mapped to a sql query not supported? #27629
Labels
area-model-building
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
type-bug
Milestone
Comments
AndriySvyryd
changed the title
navagation with keyed entity type mapped to sql query not supported?
Entity type with navigation mapped to a sql query not supported?
Apr 29, 2022
+1 I've just hit the same problem too: public class MaterialInfoConfiguration : IEntityTypeConfiguration<MaterialInfo>
{
public void Configure(EntityTypeBuilder<MaterialInfo> entity)
{
entity.ToSqlQuery("SELECT [MaterialCode], [Id] FROM [Material]");
entity.HasKey(e => e.MaterialCode);
entity.Property(e => e.Id).HasColumnName("ID");
entity.HasOne(e => e.Stocks)
.WithMany()
.IsRequired(false)
.HasForeignKey(e => e.MaterialCode)
.HasPrincipalKey(e => e.MaterialCode);
}
} |
+1, different conditions, but same problem I tried to create sql script with command like this: and the output was:
|
Verified fixed on latest daily build. |
ajcvickers
added
the
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
label
Sep 6, 2022
ajcvickers
added a commit
that referenced
this issue
Sep 6, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-model-building
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
type-bug
I'm using EF Core 6.0
I have mapped a "keyed" entity type a sql query which selects rows from a indexed view with "noexpand" hint and everything works fine.
But after I added a navigation(one-way or bi-direction) to a "parent" entity type, a System.NotSupportedException with message "SqlQuery" was thrown when execute a query.
As I know, mapping a "keyless" entity type to a sql query works with one-way navigation.
So if mapping a "keyed" entity type to a sql query is supported, why with navigation is not supported? neither one-way nor bi-direction.
Here is my code:
Stack Trace
The text was updated successfully, but these errors were encountered: