Efcore: Should the Sql you specify contain WHERE? what is the syntax for specifying a filter is based on the class properties or table column names?

Created on 10 Apr 2019  路  5Comments  路  Source: dotnet/efcore

Describe what is not working as expected.

If you are seeing an exception, include the full exceptions details (message and stack trace).

Exception message:
Stack trace:

Steps to reproduce

Include a complete code listing (or project/solution) that we can run to reproduce the issue.

Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.

c# Console.WriteLine("Hello World!");

Further technical details

EF Core version: (found in project.csproj or packages.config)
Database Provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer)
Operating system:
IDE: (e.g. Visual Studio 2017 15.4)

closed-question customer-reported

Most helpful comment

What you are looking at is API docs and not feature documentation. API docs is what shows up in intellisense. Certainly we can improve it add example.

The feature is documented here https://docs.microsoft.com/en-us/ef/core/modeling/relational/indexes#fluent-api

To answer specific questions

  • The SQL should not contain WHERE. Where will be injected automatically.
  • The syntax uses exact column names rather than class property names since we just put SQL as is without parsing inside the generated scripts for Create Index.

For more info: Feature tracking bug was https://github.com/aspnet/EntityFrameworkCore/issues/5817

All 5 comments

This issue is lacking enough information for us to effectively reproduce. Please post a runnable project/solution or complete code listing that demonstrates the behavior you are seeing.

I was just commenting on the documentation provided for HasFilter from ms site, it's hard to find any documentation about how this is specified. I was just asking for clarification, there is nothing to post for a "runnable/solution".

@jwisener - Your post does not contain any reference to HasQueryFilter. Where are you specifying the SQL? How are you planning to use it? What is the problem you are trying to solve in linq? Can you share some code snippets what you have attempted to write or what you are expecting to write and having issues?

P.S. - While you were commenting on documentation, there is no references to it is produced by the system when filing issue. So we need more details to understand the issue.

What you are looking at is API docs and not feature documentation. API docs is what shows up in intellisense. Certainly we can improve it add example.

The feature is documented here https://docs.microsoft.com/en-us/ef/core/modeling/relational/indexes#fluent-api

To answer specific questions

  • The SQL should not contain WHERE. Where will be injected automatically.
  • The syntax uses exact column names rather than class property names since we just put SQL as is without parsing inside the generated scripts for Create Index.

For more info: Feature tracking bug was https://github.com/aspnet/EntityFrameworkCore/issues/5817

Was this page helpful?
0 / 5 - 0 ratings