サーバーのソリューションに列挙値があります。
public enum TaskStatus
{
//Description attribute modifies how an Enum's label is displayed when displayed via MVC.
[Description("Draft")]
Draft = 1,
[Description("Being Planned")]
BeingPlanned = 2,
[Description("Waiting For Change")]
WaitingForChange = 3,
[Description("In Progress")]
InProgress = 4,
[Description("Waiting For Customer Information")]
WaitingCustomerInformation = 5,
[Description("Cancelled")]
Cancelled = 6,
[Description("Completed")]
Completed = 7
};
この列挙値はシリアル化され、WCFサービス参照としてクライアントに渡されます。
次に、モデルに列挙値を表示します。ただし、シリアル化/逆シリアル化プロセス中にDescription属性が削除されていることに注意してください。
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.450")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.cormant.com/cswebapi")]
public enum TaskStatus {
/// <remarks/>
Draft,
/// <remarks/>
BeingPlanned,
/// <remarks/>
WaitingForChange,
/// <remarks/>
InProgress,
/// <remarks/>
WaitingCustomerInformation,
/// <remarks/>
Cancelled,
/// <remarks/>
Completed,
}
私の列挙型をエンドユーザーにどのように表示するかを説明する機能が必要です。これを行うことは可能ですか?デシリアライズ後に属性を再適用できますか?