예제 #1
0
        /// <summary>
        /// Add a <see cref="CommandSecurityTarget"/> to the <see cref="HandleCommand">action</see>
        /// </summary>
        /// <param name="action"><see cref="HandleCommand">Action</see> to add to</param>
        /// <returns><see cref="CommandSecurityTarget"/></returns>
        public static CommandSecurityTarget Commands(this HandleCommand action)
        {
            var target = new CommandSecurityTarget();

            action.AddTarget(target);
            return(target);
        }
예제 #2
0
        /// <summary>
        /// Add a <see cref="TypeSecurable"/> to the <see cref="CommandSecurityTarget"/> for a given type
        /// </summary>
        /// <typeparam name="T">Type of <see cref="ICommand"/> to secure</typeparam>
        /// <param name="target"><see cref="CommandSecurityTarget"/> to add to</param>
        /// <param name="continueWith">Callback for continuing the fluent interface</param>
        /// <returns><see cref="TypeSecurable"/> for the specific type</returns>
        public static CommandSecurityTarget InstanceOf <T>(this CommandSecurityTarget target, Action <TypeSecurable> continueWith) where T : ICommand
        {
            var securable = new TypeSecurable(typeof(T));

            target.AddSecurable(securable);
            continueWith(securable);
            return(target);
        }
예제 #3
0
        /// <summary>
        /// Add a <see cref="NamespaceSecurable"/> to the <see cref="CommandSecurityTarget"/> for a given namespace
        /// </summary>
        /// <param name="target"><see cref="CommandSecurityTarget"/> to add to</param>
        /// <param name="namespace">Namespace to secure</param>
        /// <param name="continueWith">Callback for continuing the fluent interface</param>
        /// <returns><see cref="NamespaceSecurable"/> for the specific namespace</returns>
        public static CommandSecurityTarget InNamespace(this CommandSecurityTarget target, string @namespace, Action <NamespaceSecurable> continueWith)
        {
            var securable = new NamespaceSecurable(@namespace);

            target.AddSecurable(securable);
            continueWith(securable);
            return(target);
        }