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
The type mapping for 'Dictionary<string, string>' has not implemented code literal generation. #1318
publicclassJobDefinition{[Required]publicGuidJobDefinitionId{get;set;}[Required]publicintVersion{get;set;}[Required]publicGuidTenantId{get;set;}[Required]publicJobTypeJobType{get;set;}[Required]publicstringActionType{get;set;}[Required][Column(TypeName="jsob")]publicDictionary<string,string>Properties{get;set;}// Refers to another entitypublicList<ScheduleJobDefinitions>ScheduleJobDefinitions{get;set;}}
If I understand correctly, this should work and convert the dictionary to a json object.
When generating the migration using dotnet ef migrations add DbInitial -o Database/Migrations, the program builds but then gives the following error: The type mapping for 'Dictionary<string, string>' has not implemented code literal generation.
What could be going on? I have also tried [Column(TypeName="hstore")], but that didn't make a difference unfortunately.
You're probably trying to seed hstore data (with the HasData API). Unfortunately that's not possible currently - I'll keep this open and will try to look into it at some point.
Reacted by Giorgio Galante and Grigoris Giapantzis
The below is an AI-generated analysis and may contain inaccuracies.
This is the missing hstore seed-data scaffolding feature identified in the discussion, rather than a general JSON dictionary issue. The existing Feature classification is appropriate.
Verified on current main that HasData with an hstore-mapped Dictionary<string, string> successfully generates both the migration and model snapshot. Coverage includes populated and empty dictionaries, null dictionary values, and strings containing quotes, backslashes, and newlines. No provider code change is needed for this scenario: EF Core 7.0 added dictionary literal generation in dotnet/efcore#28330, addressing the prerequisite described above.
The related upstream collection-literal issue is dotnet/efcore#19274; no additional matching upstream issue was found. I am adding focused provider regression coverage to verify the original scenario, as requested in the maintainer comment.
This does not add arbitrary JSON dictionary support or hstore query translations. SQL literal generation is separate work tracked by #3780 and is not changed here.
Activity
roji commentedon Mar 26, 2020
You're probably trying to seed
hstoredata (with theHasDataAPI). Unfortunately that's not possible currently - I'll keep this open and will try to look into it at some point.mijgame commentedon Mar 26, 2020
That is exactly what is happening; thanks for pointing me into the right direction!
roji commentedon Jul 9, 2022
This should be unblocked by dotnet/efcore#28330, implement this mainly to verify that.
roji commentedon Oct 21, 2026
AI Triage
The below is an AI-generated analysis and may contain inaccuracies.
This is the missing hstore seed-data scaffolding feature identified in the discussion, rather than a general JSON dictionary issue. The existing Feature classification is appropriate.
Verified on current main that
HasDatawith an hstore-mappedDictionary<string, string>successfully generates both the migration and model snapshot. Coverage includes populated and empty dictionaries, null dictionary values, and strings containing quotes, backslashes, and newlines. No provider code change is needed for this scenario: EF Core 7.0 added dictionary literal generation in dotnet/efcore#28330, addressing the prerequisite described above.The related upstream collection-literal issue is dotnet/efcore#19274; no additional matching upstream issue was found. I am adding focused provider regression coverage to verify the original scenario, as requested in the maintainer comment.
This does not add arbitrary JSON dictionary support or hstore query translations. SQL literal generation is separate work tracked by #3780 and is not changed here.
roji commentedon Oct 21, 2026
Closing as per the above - everything already works since EF 7 thanks to dotnet/efcore#28330.