You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mechanism/API to specify a default conversion for any property of a given type in the model #10784
Value conversions were introduced by #242. Currently conversions are only set per-property, although bulk configuration can be used at the end of OnModelCreating in the normal way. This issue is about adding some kind of mechanism to set the conversion for all properties of a given type in the model. This could be through configuration on the model, or it could be via improved bulk config APIs.
Reacted by Dominik, bugproof, Daniel Hughes, cwe1ss, Laura Verdoes, adva, Dmytro Dizhevskyi, David Muir, Cheng Chen, Vladimir Panimaskin and 157 more
Reacted by Wojciech Torkowski, Timo van Zijll Langhout, sjd2021 and TeckTn
Reacted by Sergey Sokur, Labros Papadopoulos, Andrii Kurdiumov, Bruno Chiarini, sjd2021 and TeckTn
Note that the converter isn't really for "every property" even though it will also have that effect. It should also be for any time the CLR type is used in the query--that is, it is really a custom type mapping setup by the application.
Reacted by Tyson, Andriy Savin, Steven Rasmussen and Gur Galler
As @vanillajonathan outlined, this really should go into the value conversions article for documentation purposes. The only mention to that addition I could find was the 6.0.0-preview6 release blog article, and it took me a while to find it - even so it is perfectly what I needed.
Is there a decent workaround for efcore versions < 6? We dont have the ability to upgrade to .net 6 just yet, and have a domain model of thousands of tables that have used the old oracle convention of using bool as char(1) with constraints to Y/N. Something a value converter exists for, but is gonna make mapping this entities a royal nightmare.
@ronnyek take a look at Bulk configuration in OnModelCreating, that may work for you. Note also that EF Core 5.0 goes out of support in May, and 3.1 in December - so I'd recommend upgrading soon instead.
Activity
ajcvickers commentedon Jun 8, 2018
Note that the converter isn't really for "every property" even though it will also have that effect. It should also be for any time the CLR type is used in the query--that is, it is really a custom type mapping setup by the application.
72 remaining items
vanillajonathan commentedon Nov 23, 2021
The value conversions article needs to be updated.
Dynalon commentedon Feb 10, 2022
As @vanillajonathan outlined, this really should go into the value conversions article for documentation purposes. The only mention to that addition I could find was the
6.0.0-preview6release blog article, and it took me a while to find it - even so it is perfectly what I needed.roji commentedon Feb 10, 2022
@Dynalon @vanillajonathan I've added a bulk configuration section to the value conversions page in dotnet/EntityFramework.Docs#3716.
thomaslevesque commentedon Feb 10, 2022
Wrong link? #3716 doesn't seem to be related to this..
roji commentedon Feb 10, 2022
Sorry, wrong repo - corrected above.
ronnyek commentedon Feb 16, 2022
Is there a decent workaround for efcore versions < 6? We dont have the ability to upgrade to .net 6 just yet, and have a domain model of thousands of tables that have used the old oracle convention of using bool as char(1) with constraints to Y/N. Something a value converter exists for, but is gonna make mapping this entities a royal nightmare.
roji commentedon Feb 17, 2022
@ronnyek take a look at Bulk configuration in OnModelCreating, that may work for you. Note also that EF Core 5.0 goes out of support in May, and 3.1 in December - so I'd recommend upgrading soon instead.
igbenic commentedon Nov 18, 2022
igbenic commentedon Nov 18, 2022
roji commentedon Feb 15, 2026