How do I map to and from a complex type in EF4.3 code-first? How do I map to and from a complex type in EF4.3 code-first? oracle oracle

How do I map to and from a complex type in EF4.3 code-first?


So instead of GetSequence use a property:

public class InvoiceNumberSequence {     public string Prefix { get; set; }    public int Number { get; set; }    public string Sequence {        get { retrun Prefix + Number; }        set { // Add your parsing logic }    }}

And in mapping add:

modelBuilder.ComplexType<InvoiceNumberSequence>()            .Property(p => p.Sequence)            .HasColumnName("INVOICE_SEQ");modelBuilder.ComplexType<InvoiceNumberSequence>()            .Ignore(p => p.Prefix);modelBuilder.ComplexType<InvoiceNumberSequence>()            .Ignore(p => p.Number);