では利用できない属性:サーバー側は、私は、カスタム属性を持っているのSilverlightクライアント
[System.AttributeUsage(System.AttributeTargets.Property)]
public class MyCustomAttribute : System.Attribute
{
}
これは、ファイル内で宣言されます、それはオートコンプリート/にアップしていますように、クライアント上のクラスが可視になった、MyCustomAttribute.shared.cs
と呼ばれますクライアント上のInteliSense
public partial class MyClass
{
[Required(AllowEmptyStrings=true)]
[Display(ResourceType=typeof(ResourceFile), Name="ResourceName")]
[MyCustom]
public string MyProperty { get; set; }
}
しかし、私がしようとする性質があるかどうかを確認する場合:私はEntity
は、データベースから返されたとWCFのRIAServicesでのSilverlightクライアントに渡され、私のクラスのプロパティに追加した
属性は、リスト上に存在しない添付:返される属性の
PropertyInfo prop = GetProperty(myType, "MyProperty");
object[] attributes = prop.GetCustomAttributes(false);
foreach (object attribute in attributes)
{
if (attribute is MyCustomAttribute)
{
// Do my stuff here
}
}
なしMyCustomAttribute
ません。
私は、クライアント側で生成されたコードをチェックしましたし、このプロパティのためには、次のようになります。
/// <summary>
/// Gets or sets the 'BarcodeNumber' value.
/// </summary>
[ConcurrencyCheck()]
[DataMember()]
[Display(Name="ResourceName", ResourceType=typeof(ResourceFile))]
[Required(AllowEmptyStrings=true)]
[RoundtripOriginal()]
public string MyProperty
{
....
}
だから、はっきりと私の属性は、クライアントにコピーされていません。
私には何が欠けていますか?