Skip to content

Use of Contains() as LINQ query with Entity Framework #48694

@jarozele

Description

@jarozele

Type of issue

Missing information

Description

While generally true, there is an issue when using it as a LINQ query because Entity Framework can not translate string.Contains(char). It needs a string.Contains(string).
This can be confusing for programmers when they receive a runtime exception.

Page URL

https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1847

Content source URL

https://github.com/dotnet/docs/blob/main/docs/fundamentals/code-analysis/quality-rules/ca1847.md

Document Version Independent Id

5e1aa81d-07da-dfab-14d1-3d361e7c486b

Platform Id

d625e2cb-f7de-4a76-1c93-e6672828154c

Article author

@MeikTranel

Metadata

  • ID: 4b505c55-ce56-19b9-2c29-c39017e52345
  • PlatformId: d625e2cb-f7de-4a76-1c93-e6672828154c
  • Service: dotnet-fundamentals

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions