I just began studying WCF because i need it for a school assignment. But i have a problem when i am trying to send an object with some custom attributes. The object is:
[DataContract]
public class Person
{
[DataMember]
[Searchable("ID")]
public virtual String ID
{
get;
set;
}
[DataMember]
[Searchable("LastName")]
public virtual String LastName
{
get;
set;
}
[DataMember]
[Searchable("FirstName")]
public virtual String FirstName
{
get;
set;
}
}
The custom attribute is:
[DataContract]
[AttributeUsage(AttributeTargets.Property)]
public class Searchable:Attribute
{
public Searchable(String PropertyName)
{
this.PropertyName = PropertyName;
}
[DataMember]
public virtual String PropertyName
{
get;
set;
}
}
I use svcutil to generate the configuration file and the client. The communication between the client and the service is going on fine. But when I receive an object of type Person and try to search for attribute of type Searchable i can't find any.
Is this possible? If yes could you provide any hints on how to achieve this kind of behavior?
Thanks. Denis.