AuthorizationRule CSLA.net 4

AuthorizationRule CSLA.net 4

Old forum URL: forums.lhotka.net/forums/t/9707.aspx


JJLoubser posted on Thursday, November 04, 2010

why can I add a priority to a BusinessRule but not a AuthorizationRule in CSLA.net 4

***BusinessRule :

 private class MoreInfoMayDelete<T> : Csla.Rules.BusinessRule
        {

            public MoreInfoMayDelete(Csla.Core.IPropertyInfo primaryProperty, List<Csla.Core.IPropertyInfo> affectedProperties, int pPriority)
                : base(primaryProperty)
            {
                Priority = pPriority;

                InputProperties = new List<Csla.Core.IPropertyInfo> { PrimaryProperty };

                foreach (var prop in affectedProperties)
                {
                    AffectedProperties.Add(prop);
                }

            }

 

...

}

 

*** AuthorizationRule:

 

private class AuthorisationPropertyRule : AuthorizationRule
        {

            private List<string> _ruleSets;
            private string strElement = "";

                        /// Creates an instance of the rule.
            public AuthorisationPropertyRule(AuthorizationActions action, Csla.Core.IMemberInfo element, List<string> ruleSets, int pPriority)
                : base(action, element)
            {
               
                _ruleSets = ruleSets;
                strElement = element.Name;

                Priority = pPriority // error: no such field
            }

 

...

}

 

 

why?

RockfordLhotka replied on Thursday, November 04, 2010

For performance reasons only one authorization rule is allowed per property/operation. So there's no need for a priority, since there can be only one.

Copyright (c) Marimer LLC