Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The type mapping for 'Dictionary<string, string>' has not implemented code literal generation. #1318

Open
mijgame opened this issue Mar 24, 2020 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@mijgame
Copy link

mijgame commented Mar 24, 2020

Hi,

I have a model as follows:

    public class JobDefinition
    {
        [Required]
        public Guid JobDefinitionId { get; set; }
        
        [Required]
        public int Version { get; set; }
        
        [Required]
        public Guid TenantId { get; set; }
        
        [Required]
        public JobType JobType { get; set; }
                
        [Required]
        public string ActionType { get; set; }
        
        [Required]
        [Column(TypeName="jsob")]
        public Dictionary<string, string> Properties { get; set; }
            
        // Refers to another entity
        public List<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.

I use .NET Core 3.1.2 with Entity Framework Core.

Thanks in advance.

@roji
Copy link
Member

roji commented Mar 26, 2020

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.

@roji roji added the enhancement New feature or request label Mar 26, 2020
@roji roji added this to the Backlog milestone Mar 26, 2020
@mijgame
Copy link
Author

mijgame commented Mar 26, 2020

That is exactly what is happening; thanks for pointing me into the right direction!

@roji roji modified the milestones: Backlog, 7.0.0 Jul 9, 2022
@roji
Copy link
Member

roji commented Jul 9, 2022

This should be unblocked by dotnet/efcore#28330, implement this mainly to verify that.

@roji roji modified the milestones: 7.0.0, 8.0.0 Oct 15, 2022
@roji roji modified the milestones: 8.0.0, Backlog Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants