Code First CTP4错误映射器

时间:2011-01-03 20:49:48

标签: .net code-first

为什么我的类型总是返回0?

public class PartiesConfiguracao : EntityConfiguration<Parties>
{
    public PartiesConfiguracao()
    {
        MapHierarchy()
        .Case<Parties>(parties => new
        {
            PartiesID = parties.ID,
            ShipInstructionID = parties.ShipInstruction.ID,
            ContactID = parties.Contact.ID,
            parties.Name,
            Type = 0,
            parties.CNPJ,
            parties.Address
        })
        .Case<Shipper>(parties => new
        {
            Type = 1
        })
        .Case<Consignee>(parties => new
        {
            Type = 2
        })
        .Case<Notify>(parties => new
        {
            Type = 3
        })
        .Case<Forwarder>(parties => new
        {
            Type = 4
        })
        .ToTable("si_Parties");
    }
}

1 个答案:

答案 0 :(得分:0)

MapHierarchy 与CTP4相关,已在CTP5中删除。没有提供进一步的支持。您应该从here下载并安装CTP5,并尝试使用CTP5中引入的新的流畅API进行TPH映射。