コード例 #1
0
            /// <summary>
            /// Start the definition of a child instance by defining the concrete type
            /// </summary>
            /// <param name="pluggedType"></param>
            /// <returns></returns>
            public ConfiguredInstance IsConcreteType(Type pluggedType)
            {
                ExpressionValidator.ValidatePluggabilityOf(pluggedType).IntoPluginType(_childType);

                var childInstance = new ConfiguredInstance(pluggedType);

                _instance.SetChild(_propertyName, childInstance);

                return(_instance);
            }
コード例 #2
0
        public CreatePluginFamilyExpression <PLUGINTYPE> TheDefaultIsConcreteType <CONCRETETYPE>()
            where CONCRETETYPE : PLUGINTYPE
        {
            Type concreteType = typeof(CONCRETETYPE);

            ExpressionValidator.ValidatePluggabilityOf(concreteType).IntoPluginType(_pluginType);

            if (!PluginCache.GetPlugin(concreteType).CanBeAutoFilled)
            {
                throw new StructureMapException(231);
            }

            return(alterAndContinue(family =>
            {
                ConfiguredInstance instance =
                    new ConfiguredInstance(concreteType).WithName(concreteType.AssemblyQualifiedName);
                family.AddInstance(instance);
                family.DefaultInstanceKey = instance.Name;
            }));
        }