当前位置: 首页>>代码示例>>C#>>正文


C# MutablePropertyValues.Add方法代码示例

本文整理汇总了C#中Spring.Objects.MutablePropertyValues.Add方法的典型用法代码示例。如果您正苦于以下问题:C# MutablePropertyValues.Add方法的具体用法?C# MutablePropertyValues.Add怎么用?C# MutablePropertyValues.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Spring.Objects.MutablePropertyValues的用法示例。


在下文中一共展示了MutablePropertyValues.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Instantiation

 public void Instantiation () {
     MutablePropertyValues root = new MutablePropertyValues ();
     root.Add (new PropertyValue ("Name", "Fiona Apple"));
     root.Add (new PropertyValue ("Age", 24));
     MutablePropertyValues props = new MutablePropertyValues (root);
     Assert.AreEqual (2, props.PropertyValues.Count);
 }
开发者ID:Binodesk,项目名称:spring-net,代码行数:7,代码来源:MutablePropertyValuesTests.cs

示例2: AddAllInNullList

 public void AddAllInNullList()
 {
     MutablePropertyValues props = new MutablePropertyValues ();
     props.Add (new PropertyValue ("Name", "Fiona Apple"));
     props.Add (new PropertyValue ("Age", 24));
     props.AddAll ((IList) null);
     Assert.AreEqual (2, props.PropertyValues.Length);
 }
开发者ID:smnbss,项目名称:spring-net,代码行数:8,代码来源:MutablePropertyValuesTests.cs

示例3: ParseTestObjectDefinition

        private ObjectDefinitionHolder ParseTestObjectDefinition(XmlElement rootElement, ParserContext parserContext)
        {
            MutablePropertyValues properties = new MutablePropertyValues();
            
            XmlNodeList childNodes = rootElement.ChildNodes;

            //Get all properties (from non whitespace nodes)
            foreach (XmlNode childNode in childNodes)
            {                
                if (XmlNodeType.Whitespace != childNode.NodeType)
                {
                    properties.Add(new PropertyValue(childNode.LocalName, childNode.InnerText));
                }
            }
            IConfigurableObjectDefinition od = new RootObjectDefinition(typeof (TestObject), null, properties);
            od.IsSingleton = false;

            //HardCoded for now.
            string id = "testObject";
            //id = ObjectDefinitionReaderUtils.GenerateObjectName(od, reader.ObjectReader.Registry);

            return new ObjectDefinitionHolder(od, id);


        }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:25,代码来源:TestObjectConfigParser.cs

示例4: AddAllInNullMap

 public void AddAllInNullMap()
 {
     MutablePropertyValues props = new MutablePropertyValues ();
     props.Add (new PropertyValue ("Name", "Fiona Apple"));
     props.AddAll ((IDictionary) null);
     Assert.AreEqual (1, props.PropertyValues.Length);
 }
开发者ID:smnbss,项目名称:spring-net,代码行数:7,代码来源:MutablePropertyValuesTests.cs

示例5: getMutablePropertyValues

      private MutablePropertyValues getMutablePropertyValues(TypeRegistration registrationEntry)
      {
         MutablePropertyValues properties = new MutablePropertyValues();
         foreach (InjectedProperty property in registrationEntry.InjectedProperties)
         {
            properties.Add(new PropertyValue(property.PropertyName,getInjectionParameterValue(property.PropertyValue)));
         }

         return properties;
      }
开发者ID:ericklombardo,项目名称:Nuaguil.Net,代码行数:10,代码来源:SpringContainerConfigurator.cs

示例6: PostProcessPropertyValues

        public override IPropertyValues PostProcessPropertyValues(IPropertyValues propertyValues, PropertyInfo[] propertyInfos, object objectInstance, string objectName)
        {
            MutablePropertyValues mpv = new MutablePropertyValues(propertyValues);

            IConfigurableObjectDefinition objectDefinition = (IConfigurableObjectDefinition)_objectFactory.GetObjectDefinition(objectName);
            DependencyCheckingMode checkMode = objectDefinition.DependencyCheck;
            PropertyInfo[] unresolvedProperties = AutowireUtils.GetUnsatisfiedDependencies(propertyInfos, propertyValues, checkMode);
            foreach(PropertyInfo propertyInfo in unresolvedProperties)
            {
                object value = ResolveDependency(objectName, objectDefinition, new ObjectWrapper(objectInstance), propertyInfo);
                if (value != null)
                {
                    mpv.Add(propertyInfo.Name, value);
                }
            }

            return base.PostProcessPropertyValues(mpv, propertyInfos, objectInstance, objectName);
        }
开发者ID:eeichinger,项目名称:pons,代码行数:18,代码来源:AbstractCustomDependencyResolverPostProcessor.cs

示例7: RemoveByPropertyValue

 public void RemoveByPropertyValue () 
 {
     MutablePropertyValues props = new MutablePropertyValues ();
     PropertyValue propName = new PropertyValue ("Name", "Fiona Apple");
     props.Add (propName);
     props.Add (new PropertyValue ("Age", 24));
     Assert.AreEqual (2, props.PropertyValues.Count);
     props.Remove (propName);
     Assert.AreEqual (1, props.PropertyValues.Count);
 }
开发者ID:Binodesk,项目名称:spring-net,代码行数:10,代码来源:MutablePropertyValuesTests.cs

示例8: ParseCaoExporter

        /// <summary>
        /// Parses the CaoExporter definition.
        /// </summary>
        /// <param name="element">The element to parse.</param>
        /// <param name="name">The name of the object definition.</param>
        /// <param name="parserContext">The parser context.</param>
        /// <returns>CaoExporter object definition.</returns>
        private IConfigurableObjectDefinition ParseCaoExporter(
            XmlElement element, string name, ParserContext parserContext)
        {
            string typeName = GetTypeName(element);
            string targetName = element.GetAttribute(CaoExporterConstants.TargetNameAttribute);
            string infinite = element.GetAttribute(CaoExporterConstants.InfiniteAttribute);

            MutablePropertyValues properties = new MutablePropertyValues();
            if (StringUtils.HasText(targetName))
            {
                properties.Add("TargetName", targetName);
            }
            if (StringUtils.HasText(infinite))
            {
                properties.Add("Infinite", infinite);
            }

            foreach (XmlElement child in element.ChildNodes)
            {
                switch (child.LocalName)
                {
                    case LifeTimeConstants.LifeTimeElement:
                        ParseLifeTime(properties, child, parserContext);
                        break;
                    case InterfacesConstants.InterfacesElement:
                        properties.Add("Interfaces", base.ParseListElement(child, name, parserContext));
                        break;
                }
            }

            IConfigurableObjectDefinition cod = parserContext.ReaderContext.ObjectDefinitionFactory.CreateObjectDefinition(
                typeName, null, parserContext.ReaderContext.Reader.Domain);
            cod.PropertyValues = properties;

            return cod;
        }
开发者ID:spring-projects,项目名称:spring-net,代码行数:43,代码来源:RemotingNamespaceParser.cs

示例9: ParseLifeTime

        /// <summary>
        /// Parses the LifeTime definition.
        /// </summary>
        private void ParseLifeTime(MutablePropertyValues properties, XmlElement child, ParserContext parserContext)
        {
            string initialLeaseTime = child.GetAttribute(LifeTimeConstants.InitialLeaseTimeAttribute);
            string renewOnCallTime = child.GetAttribute(LifeTimeConstants.RenewOnCallTimeAttribute);
            string sponsorshipTimeout = child.GetAttribute(LifeTimeConstants.SponsorshipTimeoutAttribute);

            if (StringUtils.HasText(initialLeaseTime))
            {
                properties.Add("InitialLeaseTime", initialLeaseTime);
            }
            if (StringUtils.HasText(renewOnCallTime))
            {
                properties.Add("RenewOnCallTime", renewOnCallTime);
            }
            if (StringUtils.HasText(sponsorshipTimeout))
            {
                properties.Add("SponsorshipTimeout", sponsorshipTimeout);
            }
        }
开发者ID:spring-projects,项目名称:spring-net,代码行数:22,代码来源:RemotingNamespaceParser.cs

示例10: ParseNVelocityEngine

        /// <summary>
        /// Parses the object definition for the engine object, configures a single NVelocity template engine based 
        /// on the element definitions.
        /// </summary>
        /// <param name="element">the root element defining the velocity engine</param>
        /// <param name="parserContext">the parser context</param>
        private IConfigurableObjectDefinition ParseNVelocityEngine(XmlElement element, ParserContext parserContext) {
            string typeName = GetTypeName(element);
            IConfigurableObjectDefinition configurableObjectDefinition = parserContext.ReaderContext.ObjectDefinitionFactory.CreateObjectDefinition(
                typeName, null, parserContext.ReaderContext.Reader.Domain);

            string preferFileSystemAccess = GetAttributeValue(element, TemplateDefinitionConstants.AttributePreferFileSystemAccess);
            string overrideLogging = GetAttributeValue(element, TemplateDefinitionConstants.AttributeOverrideLogging);
            string configFile = GetAttributeValue(element, TemplateDefinitionConstants.AttributeConfigFile);

            MutablePropertyValues objectDefinitionProperties = new MutablePropertyValues();
            if (StringUtils.HasText(preferFileSystemAccess)) {
                objectDefinitionProperties.Add(TemplateDefinitionConstants.PropertyPreferFileSystemAccess, preferFileSystemAccess);
            }

            if (StringUtils.HasText(overrideLogging)) {
                objectDefinitionProperties.Add(TemplateDefinitionConstants.PropertyOverrideLogging, overrideLogging);
            }

            if (StringUtils.HasText(configFile)) {
                objectDefinitionProperties.Add(TemplateDefinitionConstants.PropertyConfigFile, configFile);
            }

            XmlNodeList childElements = element.ChildNodes;
            if (childElements.Count > 0) {
                ParseChildDefinitions(childElements, parserContext, objectDefinitionProperties);
            }
            configurableObjectDefinition.PropertyValues = objectDefinitionProperties;
            return configurableObjectDefinition;
        }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:35,代码来源:TemplateNamespaceParser.cs

示例11: AllValid

		public void AllValid()
		{
			TestObject t = new TestObject();
			string newName = "tony";
			int newAge = 65;
			string newTouchy = "valid";
			IObjectWrapper wrapper = GetWrapper(t);
			MutablePropertyValues pvs = new MutablePropertyValues();
			pvs.Add(new PropertyValue("Age", newAge));
			pvs.Add(new PropertyValue("Name", newName));
			pvs.Add(new PropertyValue("Touchy", newTouchy));
			wrapper.SetPropertyValues(pvs);
			Assert.IsTrue(t.Name.Equals(newName), "Validly set property must stick");
			Assert.IsTrue(t.Touchy.Equals(newTouchy), "Validly set property must stick");
			Assert.IsTrue(t.Age == newAge, "Validly set property must stick");
		}
开发者ID:spring-projects,项目名称:spring-net,代码行数:16,代码来源:ObjectWrapperTests.cs

示例12: ChangesSince

        public void ChangesSince () 
        {
            IDictionary<string, object> map = new Dictionary<string, object>();
            PropertyValue propName = new PropertyValue("Name", "Fiona Apple");
            map.Add (propName.Name, propName.Value);
            map.Add ("Age", 24);
            MutablePropertyValues props = new MutablePropertyValues (map);
            MutablePropertyValues newProps = new MutablePropertyValues (map);

            // change the name... this is the change we'll be looking for
            newProps.SetPropertyValueAt (new PropertyValue (propName.Name, "Naomi Woolf"), 0);
            IPropertyValues changes = newProps.ChangesSince (props);
            Assert.AreEqual (1, changes.PropertyValues.Count);
            // the name was changed, so its the name property that should be in the changed list
            Assert.IsTrue (changes.Contains ("name"));

            newProps.Add (new PropertyValue ("Commentator", "Naomi Woolf"));
            changes = newProps.ChangesSince (props);
            Assert.AreEqual (2, changes.PropertyValues.Count);
            // the Commentator was added, so its the Commentator property that should be in the changed list
            Assert.IsTrue (changes.Contains ("commentator"));
            // the name was changed, so its the name property that should be in the changed list
            Assert.IsTrue (changes.Contains ("name"));
        }
开发者ID:Binodesk,项目名称:spring-net,代码行数:24,代码来源:MutablePropertyValuesTests.cs

示例13: ParseChildDefinitions

        /// <summary>
        /// Parses child element definitions for the NVelocity engine. Typically resource loaders and locally defined properties are parsed here
        /// </summary>
        /// <param name="childElements">the XmlNodeList representing the child configuration of the root NVelocity engine element</param>
        /// <param name="parserContext">the parser context</param>
        /// <param name="objectDefinitionProperties">the MutablePropertyValues used to configure this object</param>
        private void ParseChildDefinitions(XmlNodeList childElements, ParserContext parserContext, MutablePropertyValues objectDefinitionProperties) {
            IDictionary<string, object> properties = new Dictionary<string, object>();

            foreach (XmlElement element in childElements) {
                switch (element.LocalName) {
                    case TemplateDefinitionConstants.ElementResourceLoader:
                        ParseResourceLoader(element, objectDefinitionProperties, properties);
                        break;
                    case TemplateDefinitionConstants.ElementNVelocityProperties:
                        ParseNVelocityProperties(element, parserContext, properties);
                        break;
                }
            }

            if (properties.Count > 0) {
                objectDefinitionProperties.Add(TemplateDefinitionConstants.PropertyVelocityProperties, properties);
            }
        }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:24,代码来源:TemplateNamespaceParser.cs

示例14: ParseExceptionAction

        private IObjectDefinition ParseExceptionAction(XmlElement element, ParserContext parserContext)
        {
            string typeName = "Spring.Validation.Actions.ExceptionAction, Spring.Core";
            string throwExpression = GetAttributeValue(element, ValidatorDefinitionConstants.ThrowAttribute);

            
            ConstructorArgumentValues ctorArgs = new ConstructorArgumentValues();
            ctorArgs.AddGenericArgumentValue(throwExpression);

            string when = GetAttributeValue(element, ValidatorDefinitionConstants.WhenAttribute);
            MutablePropertyValues properties = new MutablePropertyValues();
            if (StringUtils.HasText(when))
            {
                properties.Add("When", when);
            }

            IConfigurableObjectDefinition action =
                parserContext.ReaderContext.ObjectDefinitionFactory.CreateObjectDefinition(typeName, null, parserContext.ReaderContext.Reader.Domain);
            action.ConstructorArgumentValues = ctorArgs;
            action.PropertyValues = properties;

            return action;
        }
开发者ID:likesea,项目名称:spring.net,代码行数:23,代码来源:ValidationNamespaceParser.cs

示例15: ParseValidatorReference

        /// <summary>
        /// Creates object definition for the validator reference.
        /// </summary>
        /// <param name="element">The action definition element.</param>
        /// <param name="parserContext">The parser helper.</param>
        /// <returns>Generic validation action definition.</returns>
        private IObjectDefinition ParseValidatorReference(XmlElement element, ParserContext parserContext)
        {
            string typeName = "Spring.Validation.ValidatorReference, Spring.Core";
            string name = GetAttributeValue(element, ValidatorDefinitionConstants.ReferenceNameAttribute);
            string context = GetAttributeValue(element, ValidatorDefinitionConstants.ReferenceContextAttribute);
            string when = GetAttributeValue(element, ValidatorDefinitionConstants.WhenAttribute);

            MutablePropertyValues properties = new MutablePropertyValues();
            properties.Add("Name", name);
            if (StringUtils.HasText(context))
            {
                properties.Add("Context", context);
            }
            if (StringUtils.HasText(when))
            {
                properties.Add("When", when);
            }

            IConfigurableObjectDefinition reference =
                parserContext.ReaderContext.ObjectDefinitionFactory.CreateObjectDefinition(typeName, null, parserContext.ReaderContext.Reader.Domain);
            reference.PropertyValues = properties;
            return reference;
        }
开发者ID:likesea,项目名称:spring.net,代码行数:29,代码来源:ValidationNamespaceParser.cs


注:本文中的Spring.Objects.MutablePropertyValues.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。