예제 #1
0
        /// <summary>
        /// Creates a new strategy for activating the specified type.
        /// </summary>
        /// <param name="typeName">The short name of the type involved in the strategy.</param>
        /// <param name="requiresAuthorisation">A value indicating whether the strategy requires authorisation.</param>
        /// <returns></returns>
        static public IActivateStrategy New(string typeName, bool requiresAuthorisation)
        {
            IActivateStrategy strategy = StrategyState.Strategies.Creator.NewActivator(typeName);

            strategy.RequireAuthorisation = requiresAuthorisation;
            return(strategy);
        }
예제 #2
0
        /// <summary>
        /// Creates a new strategy for activating the specified type.
        /// </summary>
        /// <param name="entity">The entity involved in the strategy.</param>
        /// <param name="requiresAuthorisation">A value indicating whether the strategy requires authorisation.</param>
        /// <returns></returns>
        static public IActivateStrategy New(IEntity entity, bool requiresAuthorisation)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            IActivateStrategy strategy = StrategyState.Strategies.Creator.NewActivator(entity.ShortTypeName);

            strategy.RequireAuthorisation = requiresAuthorisation;
            return(strategy);
        }