In the CSLA.NET Framework, what is the purpose of the CanReadProperty meth开发者_如何学Cod?
It's a method that allows to check whether it is allowed to read a certain property:
/// <summary>
/// Returns <see langword="true" /> if the user is allowed to read the
/// calling property.
/// </summary>
/// <param name="property">Property to check.</param>
[EditorBrowsable(EditorBrowsableState.Advanced)]
public virtual bool CanReadProperty(Csla.Core.IPropertyInfo property)
{
bool result = true;
VerifyAuthorizationCache();
if (!_readResultCache.TryGetValue(property.Name, out result))
{
result = BusinessRules.HasPermission(AuthorizationActions.ReadProperty, property);
// store value in cache
_readResultCache[property.Name] = result;
}
return result;
}
Basically it allows you to have different access permissions for individual properties on a business object.
It gives specific access permission to the Data contract Properties.
精彩评论