Skip to content

Uses Units.Net with Entity Framework #114

@surrealist

Description

@surrealist

I would like to use Units.Net in entity classes for Entity Framework. For example:

public class Box {
    public int Id { get; set; }
    public string Color { get; set; }
    public Length Width { get; set; }
    public Length Height { get; set; }
}

I found that EF ignored the Width and Height property (so I have only 2 columns left in the table) I don't sure that because of Length is struct or not.

Id Color
1 Yellow
2 Orange

It could be possible if in this case Length is a ComplexType class then it will be created with multiple embedded columns in database table such as Width_Amount and Width_Unit.

Id Color Width_Amount Width_Unit Height_Amount Height_Unit
1 Yellow 50 cm 90 cm
2 Orange 600 mm 120 mm

Please give me suggestion or your opinion on this.

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