Skip to content

Value Converters for ID/Key Types #6

@ardalis

Description

@ardalis

I'm still struggling to get something like this working with the 2.1 bits:

        public struct BlogId
        {
            public BlogId(int id)
            {
                Id = id;
            }
            public int Id { get; set; }
        }

        public class Blog
        {
            public BlogId BlogId { get; set; }
            public string BlogUrl { get; set; }
            public Theme Theme { get; set; }
        }

What I'd like is for dotnet ef database update to produce the same structure as if I simply had public int BlogId {get; set; } on Blog. Can you add an example showing how to set up this kind of thing? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions