Example #1
0
 private void ProcessSingleton(BuildRule buildRule, Type buildType)
 {
     if (buildRule.mode == Mode.Singleton)
     {
         builder.Policies.Set <ISingletonPolicy>(new SingletonPolicy(true), buildType, buildRule.name);
     }
 }
Example #2
0
        private void ProcessMappedType(BuildRule buildRule, Type buildType)
        {
            if (buildRule.mappedtype == null)
            {
                return;
            }

            Type type = Type.GetType(buildRule.mappedtype.type);
            TypeMappingPolicy policy = new TypeMappingPolicy(type, buildRule.mappedtype.name);

            builder.Policies.Set <ITypeMappingPolicy>(policy, buildType, buildRule.name);
        }
Example #3
0
        private void ProcessProperties(BuildRule buildRule, Type buildType)
        {
            if (buildRule.property == null)
            {
                return;
            }

            PropertySetterPolicy policy = new PropertySetterPolicy();

            foreach (Property prop in buildRule.property)
            {
                policy.Properties.Add(prop.name, new PropertySetterInfo(prop.name, GetParameterFromConfigParam(prop.Item)));
            }

            builder.Policies.Set <IPropertySetterPolicy>(policy, buildType, buildRule.name);
        }
Example #4
0
        private void ProcessConstructor(BuildRule buildRule, Type buildType)
        {
            if (buildRule.constructorparams == null)
            {
                return;
            }

            ConstructorPolicy policy = new ConstructorPolicy();

            foreach (object param in buildRule.constructorparams.Items)
            {
                policy.AddParameter(GetParameterFromConfigParam(param));
            }

            builder.Policies.Set <ICreationPolicy>(policy, buildType, buildRule.name);
        }