.net 4.0 - DataAnnotations: Visual Studio does not let to override RequiresValidationContext property -


i trying implement custom validation attribute inheriting validationattribute , found strange thing.
custom attribute requires validation context, i've looked @ r# decompiled source of validationattribute , saw, need override in custom attribute class:

public virtual bool requiresvalidationcontext {     {     return false;   } } 

now fun part - visual studio 2012 not let me that, telling me there's no such property override, although when running project, in debug view can see property.

interesting thing is, in reference path see:

c:\program files (x86)\reference assemblies\microsoft\framework.netframework\v4.0\system.componentmodel.dataannotations.dll

but in r# decompiled file different path:

assembly location: c:\windows\microsoft.net\framework\v4.0.30319\system.componentmodel.dataannotations.dll

so, compiler uses different dll runtime. so, i've tried switch reference dll 1 r# decompiles, looks vs2012 replacing it's version anyway, in project file looks like:

<reference include="system.componentmodel.dataannotations" /> 

so, no path saved in project. there solution without manual editing of project?

btw, 4.5 net works fine, mean sees requiresvalidationcontext property supposed.

update: say, picture worth thousand words:

enter image description here

the solution simple property requiresvalidationcontext added validationattribute in .net 4.5. since coding/using/developing c# 4.0, suspect target .net framework 4.0 , in version property not exist.

so can´t override property, cause not exist.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -