Exemple #1
0
			public void Add(PropertyBinding propertyBinding, MemberInfo memberInfo)
			{
				Entry entry = new Entry();
				entry.PropertyBinding = propertyBinding;
				entry.MemberInfo = memberInfo;
				_table.Add(propertyBinding.Name, entry);
			}
Exemple #2
0
            public void Add(PropertyBinding propertyBinding, MemberInfo memberInfo)
            {
                Entry entry = new Entry();

                entry.PropertyBinding = propertyBinding;
                entry.MemberInfo      = memberInfo;
                _table.Add(propertyBinding.Name, entry);
            }
Exemple #3
0
		public PropertyBinding[] GetProperties(Type type)
		{
			PropertyBinding[] result = new PropertyBinding[3];
			result[0] = new MyPropertyBinding(0, typeof(int));
			result[1] = new MyPropertyBinding(1, typeof(string));
			result[2] = new MyPropertyBinding(2, typeof(DateTime));
			return result;
		}
Exemple #4
0
        public PropertyBinding[] GetProperties(Type type)
        {
            if (type == null)
            {
                throw ExceptionBuilder.ArgumentNull("type");
            }

            PropertyTable          propertyTable = new PropertyTable();
            List <PropertyBinding> propertyList  = new List <PropertyBinding>();

            // Convert CLR Properties

            PropertyInfo[] propertyInfos = type.GetProperties(_bindingFlags);

            foreach (PropertyInfo currentPropertyInfo in propertyInfos)
            {
                // Ignore indexer
                ParameterInfo[] indexParameters = currentPropertyInfo.GetIndexParameters();
                if (indexParameters != null && indexParameters.Length > 0)
                {
                    continue;
                }

                PropertyBinding property = CreateProperty(currentPropertyInfo);

                if (property != null)
                {
                    AddProperty(propertyTable, propertyList, type, property, currentPropertyInfo);
                }
            }

            // Convert CLR Fields

            FieldInfo[] fieldInfos = type.GetFields(_bindingFlags);

            foreach (FieldInfo currentFieldInfo in fieldInfos)
            {
                PropertyBinding property = CreateProperty(currentFieldInfo);

                if (property != null)
                {
                    AddProperty(propertyTable, propertyList, type, property, currentFieldInfo);
                }
            }

            return(propertyList.ToArray());
        }
		public EnumerableTableBinding(IEnumerable enumerable, Type rowType, PropertyBinding[] properties, string tableName)
		{
			if (enumerable == null)
				throw ExceptionBuilder.ArgumentNull("enumerable");
			
			if (rowType == null)
				throw ExceptionBuilder.ArgumentNull("rowType");
			
			if (properties == null)
				throw ExceptionBuilder.ArgumentNull("properties");

			if (tableName == null)
				throw ExceptionBuilder.ArgumentNull("tableName");

			_enumerable	= enumerable;
			_rowType = rowType;
			_properties = properties;
			_tableName = tableName;
		}
Exemple #6
0
		private static void AddProperty(PropertyTable propertyTable, ICollection<PropertyBinding> memberList, Type declaringType, PropertyBinding memberBinding, MemberInfo memberInfo)
		{
			// Check if we already have a member with the same name declared.
			PropertyTable.Entry exisitingMemberEntry = propertyTable[memberBinding.Name];
	
			if (exisitingMemberEntry != null)
			{
				// Ok we have one. Check if the existing member is not more specific.
				if (ExistingMemberIsMoreSpecific(declaringType, exisitingMemberEntry.MemberInfo, memberInfo))
				{
					// The existing member is more specific. So we don't add the new one.
					return;
				}
				else
				{
					// The new member is more specific. Remove the old one.
					propertyTable.Remove(exisitingMemberEntry);
					memberList.Remove(exisitingMemberEntry.PropertyBinding);
				}
			}
	
			// Either the new member is more specific or we don't had
			// a member with same name.
			propertyTable.Add(memberBinding, memberInfo);
			memberList.Add(memberBinding);
		}
Exemple #7
0
        private static void AddProperty(PropertyTable propertyTable, ICollection <PropertyBinding> memberList, Type declaringType, PropertyBinding memberBinding, MemberInfo memberInfo)
        {
            // Check if we already have a member with the same name declared.
            PropertyTable.Entry exisitingMemberEntry = propertyTable[memberBinding.Name];

            if (exisitingMemberEntry != null)
            {
                // Ok we have one. Check if the existing member is not more specific.
                if (ExistingMemberIsMoreSpecific(declaringType, exisitingMemberEntry.MemberInfo, memberInfo))
                {
                    // The existing member is more specific. So we don't add the new one.
                    return;
                }
                else
                {
                    // The new member is more specific. Remove the old one.
                    propertyTable.Remove(exisitingMemberEntry);
                    memberList.Remove(exisitingMemberEntry.PropertyBinding);
                }
            }

            // Either the new member is more specific or we don't had
            // a member with same name.
            propertyTable.Add(memberBinding, memberInfo);
            memberList.Add(memberBinding);
        }
Exemple #8
0
		public void AcceptProperty(PropertyBinding property)
		{
			Add(property.Name, property.GetFullName(), property.DataType.Name, PROPERTY_IMG_INDEX);
		}
 public PropertyColumnBinding(TableBinding tableBinding, PropertyBinding propertyDefinition)
     : base(tableBinding)
 {
     _propertyDefinition = propertyDefinition;
 }
Exemple #10
0
 void IErrorReporter.AmbiguousProperty(SourceRange sourceRange, Identifier identifier, PropertyBinding[] candidates)
 {
     string message = String.Format(CultureInfo.CurrentCulture, Resources.AmbiguousProperty, identifier, FormattingHelpers.FormatBindingList(candidates));
     HandleError(sourceRange, ErrorId.AmbiguousProperty, message);
 }
		public PropertyColumnBinding(TableBinding tableBinding, PropertyBinding propertyDefinition)
			: base(tableBinding)
		{
			_propertyDefinition = propertyDefinition;
		}
Exemple #12
0
		public void AcceptProperty(PropertyBinding property)
		{
		}