Reputation: 7862
I have a System.Version object in one of my POCO entities using a Code First Entity Framework 6 application. I'd like to map it to the database as:
table Diagnostics
column ApplicationVersionMajor int
column ApplicationVersionMinor int
column ApplicationVersionBuild int
column ApplicationVersionRevision int
How do I do that when the class is something like:
class Diagnostics
{
public System.Version ApplicationVersion { get; set; }
}
I know I can decorate my own value objects with a [ComplexType] attribute; I just don't know how I would do this for a framework type.
Upvotes: 3
Views: 641
Reputation: 6501
Since System.Version is a class it can be a complex type. You can mark it as a complex type with fluent interface.
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.ComplexType<System.Version>();
}
Upvotes: 2