0
指定數組元素
所以,我有以下的ComplexType:如何爲的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
}
數組表示會有針對特定領域的多種選擇。但正如您所知,複雜類型只能包含基本屬性。那麼我怎麼能做到這一點?