DevExpressのナレッジベースは、ここでこれを達成する方法を説明しています:KA18907。 2.2節と2.3節を参照してください。あなたのビジネス・オブジェクトがエディタと同じモジュール内で宣言されている場合は
、あなたはこれを行うことができます。
//Class declared in a WinForms module, for example
public class BusinessObject : BaseObject {
...
[ModelDefault("PropertyEditorType", "SampleSolution.Module.Win.PropertyEditors.CustomStringEditor")]
public string Description {
get { return GetPropertyValue<string>("Description"); }
set { SetPropertyValue<string>("Description", value); }
}
}
そうでない場合は、代わりにEditorAlias
属性を使用します。
public class BusinessObject : BaseObject {
...
[EditorAlias("CustomStringEdit")]
public string Description {
get { return GetPropertyValue<string>("Description"); }
set { SetPropertyValue<string>("Description", value); }
}
}
とあなたのエディタで同じ文字列の識別子を設定します。 (これにより、別々のエディタに別々のWebモジュールとWinモジュールを指定することができます)。
[PropertyEditor(typeof(String), "CustomStringEdit", false)]
public class CustomStringEditor : StringPropertyEditor {
public CustomStringEditor(Type objectType, IModelMemberViewItem info)
: base(objectType, info) { }
...
}
私はプラットフォーム独立モジュールで宣言されたビジネスオブジェクトを持っています。これがEntity Framework Contextの場所なので、そこに必要です。 –
2.3で説明したように 'EditorAlias'を使用してください。 – shamp00