dotnet / dotnet/docs

Use of Contains() as LINQ query with Entity Framework

Open
#48,694 1 comment 1 reaction 0 assignees View on GitHub
:watch: Not Triaged dotnet-fundamentals/svc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
19h 10m
Merged PRs (30d)
268

Description

### 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](https://github.com/dotnet/docs/issues?q=is%3Aissue+is%3Aopen+5e1aa81d-07da-dfab-14d1-3d361e7c486b)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.