Beispiel #1
0
		public void Resolve(IServiceProvider services)
		{
			MyServices = services;
            MyOptions = (ExpressionOptions)services.GetService(typeof(ExpressionOptions));
            MyContext = (ExpressionContext)services.GetService(typeof(ExpressionContext));
			this.ResolveInternal();
			this.Validate();
		}
Beispiel #2
0
		protected static bool IsOwnerMemberAccessible(MemberInfo member, ExpressionOptions options)
		{
			bool accessAllowed = false;

			// Get the allowed access defined in the options
			if (IsMemberPublic(member) == true) {
				accessAllowed = (options.OwnerMemberAccess & BindingFlags.Public) != 0;
			} else {
				accessAllowed = (options.OwnerMemberAccess & BindingFlags.NonPublic) != 0;
			}

			// See if the member has our access attribute defined
            var attr = Attribute.GetCustomAttribute(member, typeof(ExpressionOwnerMemberAccessAttribute));

			if (attr == null) {
				// No, so return the access level
				return accessAllowed;
			} else {
				// Member has our access attribute defined; use its access value instead
                return ((ExpressionOwnerMemberAccessAttribute)attr).AllowAccess;
			}
		}