Jak najpierw mapować na iz typu złożonego w kodzie EF4.3?

Mam taki typ encji:

public class Invoice{
    public int Id { get; set; }
    public InvoiceNumberSequence Sequence { get; set; }
    public decimal Amount { get; set; }
}

TheInvoiceNumberSequence wygląda tak:

public class InvoiceNumberSequence { 
    public string Prefix { get; set; }
    public int Number { get; set; }

    public string GetSequence() {
        return Prefix + Number;
    }
}

Mój problem polega na tym, że mam istniejącą bazę danych, której nie mogę zmienić i próbuję mapować tabele / kolumny do mojego modelu domeny. Oto jak wygląda stół:

[SYSTEMINVOICES]
INVOICE_ID int
INV_TOTAL decimal
INVOICE_SEQ varchar(255)

mamDbContext lubię to:

public MyDatabaseContext : DbContext {
    public DbSet<Invoice> Invoices { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder) {
        modelBuilder.Entity<PredictedHeat>().ToTable("SYSTEMINVOICES");
        modelBuilder.Entity<Invoice>().HasKey(p => p.Id);
        modelBuilder.Entity<Invoice>().Property(p => p.Id).HasColumnName("INVOICE_ID");
        modelBuilder.Entity<Invoice>().Property(p => p.Amount).HasColumnName("INV_TOTAL");        
        //need something here to map my invoice sequence to my database table
    }
}

Muszę zmapować InvoiceNumberSequence w obu kierunkach ... 1) z pola bazy danych do klasy InvoiceNumberSequence AND 2) z metody InvoiceNumberSequence.GetSequence () do pola bazy danych.

Jak mogę to zrobić?

questionAnswers(1)

yourAnswerToTheQuestion