示例#1
0
        /// <summary>
        /// Adds specified value to context.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="key">The key of the value :D.</param>
        /// <param name="value">The value of the key :D.</param>
        /// <returns>Specified context with new value.</returns>
        public object AddToContext(object context, string key, object value)
        {
            FractusContainerContext fractusContext = (FractusContainerContext)context;

            fractusContext.Parameters.Add(key, value);
            return(fractusContext);
        }
示例#2
0
        /// <summary>
        /// Creates the context.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <returns>New context instance.</returns>
        public object CreateContext(IDependencyContainer container, string key, object value)
        {
            FractusDependencyContainer fractusContainer = (FractusDependencyContainer)container;

            FractusContainerContext context = new FractusContainerContext(fractusContainer.Container, typeof(object));

            context.Parameters.Add(key, value);
            return(context);
        }
示例#3
0
        /// <summary>
        /// Creates a new instance of the specified type.
        /// </summary>
        /// <param name="context">The context in which the activation is occurring.</param>
        /// <returns>The instance of the specified type.</returns>
        protected override IPackageValidator CreateInstance(Ninject.Core.Activation.IContext context)
        {
            FractusContainerContext    fractusContext = (FractusContainerContext)context;
            IDatabaseConnectionManager dbMan          = (IDatabaseConnectionManager)fractusContext.Parameters["IDatabaseConnectionManager"];

            ExtensiblePackageValidator validator       = new ExtensiblePackageValidator();
            SchemaPackageValidator     schemaValidator = new SchemaPackageValidator(new FractusPackageSchemaProvider(dbMan));

            validator.AddValidator(schemaValidator);
            return(validator);
        }