如何确定是从Serializiaton调用还是反序列化?
我需要这样的东西:
protected override IValueProvider CreateMemberValueProvider(MemberInfo member)
{
IValueProvider valueProvider = base.CreateMemberValueProvider(member);
if (member.CustomAttributes.First().AttributeType == typeof(EncryptedAttribute))
{
object value = valueProvider.GetValue(_object);
if(IsInSerialization())
{
valueProvider.SetValue(_object, Encrypt(value));
}
else
{
valueProvider.SetValue(_object, Decrypt(value));
}
}
return valueProvider;
}