public void AddBindings(PropertyInfo propertyInfo, List<FieldInfo> fieldList, Type type)
        {
            bool isActive = fieldList.Count == 1;
            string propertyName = propertyInfo.Name;

            if (fieldList.Count > 5)
            {
                DomainMessageSource.Instance.Write( propertyInfo, SeverityType.Warning, "INPC007", propertyInfo.Name );
            }

            foreach ( FieldInfo field in fieldList )
            {
                FieldValueBinding fieldValueBinding = new FieldValueBinding(propertyName, filedInfos[field.Name], isActive);

                List<FieldValueBinding> fieldValueBindings;
                if (!this.propertyToFieldMapping.TryGetValue(propertyName, out fieldValueBindings))
                {
                    fieldValueBindings = new List<FieldValueBinding>();
                    this.propertyToFieldMapping.Add(propertyName, fieldValueBindings);
                }

                fieldValueBindings.Add (fieldValueBinding);

                List<string> propertyList;
                if (!this.fieldToPropertyMapping.TryGetValue(fieldValueBinding.Field.FieldName, out propertyList))
                {
                    propertyList = new List<string>();
                    this.fieldToPropertyMapping.Add(fieldValueBinding.Field.FieldName, propertyList);
                }

                propertyList.Add(propertyName);
            }
        }
        public void AddBindings(PropertyInfo propertyInfo, List <FieldInfo> fieldList, Type type)
        {
            bool   isActive     = fieldList.Count == 1;
            string propertyName = propertyInfo.Name;

            if (fieldList.Count > 5)
            {
                DomainMessageSource.Instance.Write(propertyInfo, SeverityType.Warning, "INPC007", propertyInfo.Name);
            }

            foreach (FieldInfo field in fieldList)
            {
                FieldValueBinding fieldValueBinding = new FieldValueBinding(propertyName, filedInfos[field.Name], isActive);

                List <FieldValueBinding> fieldValueBindings;
                if (!this.propertyToFieldMapping.TryGetValue(propertyName, out fieldValueBindings))
                {
                    fieldValueBindings = new List <FieldValueBinding>();
                    this.propertyToFieldMapping.Add(propertyName, fieldValueBindings);
                }

                fieldValueBindings.Add(fieldValueBinding);

                List <string> propertyList;
                if (!this.fieldToPropertyMapping.TryGetValue(fieldValueBinding.Field.FieldName, out propertyList))
                {
                    propertyList = new List <string>();
                    this.fieldToPropertyMapping.Add(fieldValueBinding.Field.FieldName, propertyList);
                }

                propertyList.Add(propertyName);
            }
        }
        public void AddBinding(string property, FieldInfo field, Type type)
        {
            FieldValueBinding fieldValueBinding = new FieldValueBinding( property, field, type );
            this.propertyToFieldMapping.Add( property, fieldValueBinding );

            List<string> propertyList;
            if ( !this.fieldToPropertyMapping.TryGetValue( fieldValueBinding.Field.FieldName, out propertyList ) )
            {
                propertyList = new List<string>();
                this.fieldToPropertyMapping.Add(fieldValueBinding.Field.FieldName, propertyList);
            }

            propertyList.Add( property );
        }
        public bool TryGetSourceFieldBinding(string property, out FieldValueBinding binding)
        {
            List <FieldValueBinding> bindings;

            if (!this.propertyToFieldMapping.TryGetValue(property, out bindings))
            {
                binding = null;
                return(false);
            }

            binding = bindings.SingleOrDefault(b => b.IsActive);

            return(binding != null);
        }
Ejemplo n.º 5
0
        public void AddBinding(string property, FieldInfo field, Type type)
        {
            FieldValueBinding fieldValueBinding = new FieldValueBinding(property, field, type);

            this.propertyToFieldMapping.Add(property, fieldValueBinding);

            List <string> propertyList;

            if (!this.fieldToPropertyMapping.TryGetValue(fieldValueBinding.Field.FieldName, out propertyList))
            {
                propertyList = new List <string>();
                this.fieldToPropertyMapping.Add(fieldValueBinding.Field.FieldName, propertyList);
            }

            propertyList.Add(property);
        }
Ejemplo n.º 6
0
 public bool TryGetSourceFieldBinding(string property, out FieldValueBinding second)
 {
     return(this.propertyToFieldMapping.TryGetValue(property, out second));
 }
 public bool TryGetSourceFieldBinding(string property, out FieldValueBinding second)
 {
     return this.propertyToFieldMapping.TryGetValue(property, out second);
 }
        public bool TryGetSourceFieldBinding(string property, out FieldValueBinding binding)
        {
            List<FieldValueBinding> bindings;
            if (!this.propertyToFieldMapping.TryGetValue(property, out bindings))
            {
                binding = null;
                return false;
            }

            binding = bindings.SingleOrDefault( b => b.IsActive );

            return binding != null;
        }