Mark,
In a class which implements IContextProperty you should have a method:
public IMessageSink GetObjectSink(MarshalByRefObject o, IMessageSink next)
That's probably where you create an instance of IMessageSink implementor.
You could pass o (this is your actual context-bound object) to the
constructor and save it in a field:
public IMessageSink GetObjectSink (MarshalByRefObject o, IMessageSink next)
{
return new MySink(o, next);
}
class MySink
{
MyBusinessObject obj;
public MySink (MarshalByRefObject o, IMessageSink next)
{
obj = (MyBusinessObject)o;
}
}
Now it's a piece of cake to get the attributes:
public IMessage SyncProcessMessage (IMessage msg)
{
IMethodMessage call = msg as IMethodMessage;
if(call.MethodName == "FieldGetter"){
//Get the name of the field being accessed
string fldName = (string)call.GetArg(1);
FieldInfo fld = obj.GetType().GetField(fldName);
Attribute[] attrs = fld.GetAttributes();
...
The sample is a mess, but you should get the idea.
I also tried to implement the call interception framework...
HTH,
Alexander
"Mark" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> Am trying to write custom validation attributes for public fields,
> properties, methods etc. using context-bound programming.
>
> It works fine for properties, methods, parameters etc.
>
> But, when intercepting a Set of a public field, there appears to be an
> underlying method set up; a FieldSetter, which take parameters type,
> fieldname and fieldvalue.
>
> The problem is that my Field's Custom Attributes don't seem to be
> copied to the FieldSetter, so I can't determine what validation to
> perform.
>
> Can someone shed some light on this one? I'd really be most grateful
> 
>
> Mark.