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.
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>();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.