dotnet / dotnet/efcore

Detect primitive collections automatically once the element type is known

Open
#32,587 6 comments 0 reactions 0 assignees View on GitHub
area-model-building area-primitive-collections area-type-mapping customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

I'm not sure if this is already implemented or not. Found some closed issues, but no documentation on it.

I have a column definition that is of type `IEnumerable`. LanguageId is basically a value object that has a custom valueconverter/valuecomparer implemented and already registered in EF (and it's working fine when I have a column of type `LanguageId`).

Now, on the above example, I'm getting the following error: The 'IEnumerable' property 'Installation.Languages' could not be mapped because the database provider does not support this type. Consider converting the property value to a type supported by the database using a value converter.

I understand the error message, but I already implemented a valueconverter that converts the object LanguageId from/to a primitive value (string). What I don't know is how to configure that property, so EF understands that it has to run the converter on every entry, much like when its working on a simple property.

Is there a way to do that? I would like to do so, so I can retain the ability to later query that column. Having to write a custom converter for the IEnumerable<> would not allow me to query the column via "Contains", for example.

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.