0

所以我有以下 ComplexType:

[ComplexType]
public class TransactionSettings
{
    [Display(Name = "Minimum Order Amount"), Column(TypeName = "MONEY")]
    public decimal MinimumOrder { get; set; }
    [Display(Name = "Payment Provider")]
    public PaymentProvider PaymentProvider { get; set; }
    [Display(Name = "Provider Settings")]
    public ProviderSettings ProviderSettings { get; set; }
    [Display(Name = "Accepted Credit Cards")]
    public CreditCards[] AcceptedCreditCards { get; set; }
    [Display(Name = "Taxable States")]
    public States[] SalesTaxStates { get; set; }
}

public enum CreditCards
{
    MasterCard,
    Visa,
    [Description("American Express")]
    AmericanExpress,
    Discover
}

public enum States
{
    [Description("Alabama")]
    AL,
    [Description("Alaska")]
    AK,
    [Description("Arizona")]
    AZ,
    //.
    //.
    //.
    [Description("Wisconsin")]
    WI,
    [Description("Wyoming")]
    WY
}

该数组表示特定字段将有多项选择。但如您所知,复杂类型只能包含原始属性。那么我怎样才能做到这一点呢?

4

1 回答 1

0

我通过将所有枚举标记为Flags. 从那里开始很容易......

于 2013-06-16T20:32:00.110 回答