Пример #1
0
 public void AddFieldInfoToCache(IDataFieldInfo fieldInfo)
 {
     if (fieldInfo != null)
     {
         this.cachedFieldDescriptions[fieldInfo.Name] = fieldInfo;
     }
 }
Пример #2
0
 /// <summary>
 /// Deep copies content from src instance to this.
 /// <param name="source">Source for copy.</param>
 /// <returns>this.</returns>
 /// </summary>
 protected override IRecordInterface CopyFromImpl(IRecordInfo source)
 {
     base.CopyFromImpl(source);
     if (typeof(IDataFieldInfo).IsInstanceOfType(source))
     {
         IDataFieldInfo typedSource = ((IDataFieldInfo)(source));
         if ((typedSource.DataType != null))
         {
             if (((this.DataType == null) ||
                  (this.DataType.GetType() == typedSource.DataType.GetType())))
             {
                 this.DataType = ((DataType)(typedSource.DataType.Clone()));
             }
             else
             {
                 this.DataType.CopyFrom(typedSource.DataType);
             }
         }
         else
         {
             this.DataType = null;
         }
     }
     return(this);
 }
Пример #3
0
        private DataGridColumn CreateColumn(IDataFieldInfo fieldInfo)
        {
            var context = new GenerateColumnContext();

            if (fieldInfo != null)
            {
                context.FieldInfo = fieldInfo;
            }

            this.GridView.CommandService.ExecuteCommand(CommandId.GenerateColumn, context);
            if (context.Result == null)
            {
                // user have not specified a result, we assume that this means to skip the current column
                return(null);
            }

            DataGridTypedColumn typedColumn = context.Result as DataGridTypedColumn;

            if (typedColumn != null)
            {
                typedColumn.PropertyInfo = fieldInfo;
            }

            context.Result.IsAutoGenerated = true;

            return(context.Result);
        }
Пример #4
0
        private void CheckDataDescriptorsCompatibility(IList descriptors)
        {
            // group descriptors
            for (int i = 0; i < descriptors.Count; i++)
            {
                var descriptor = descriptors[i] as DataDescriptor;
                if (descriptor.IsDelegate)
                {
                    continue;
                }

                IDataFieldInfo field = null;

                if (this.CurrentDataProvider.FieldDescriptions != null)
                {
                    field = this.CurrentDataProvider.FieldDescriptions.GetFieldDescriptionByMember(descriptor.EngineDescription.PropertyName);
                }

                if (field == null || !field.Equals(descriptor.EngineDescription.MemberAccess as IDataFieldInfo))
                {
                    // descriptor is incompatible, remove it
                    descriptors.RemoveAt(i);
                    i--;
                }
            }
        }
Пример #5
0
        public bool Equals(IDataFieldInfo info)
        {
            var propertyField = info as PropertyInfoFieldInfo;

            if (propertyField == null)
            {
                return(false);
            }

            return(propertyField.propertyInfo.DeclaringType.GetTypeInfo().IsAssignableFrom(this.propertyInfo.DeclaringType.GetTypeInfo()));
        }
Пример #6
0
        /// <inheritdoc />
        internal override IGroupDescription GetGroupDescriptionForFieldDescription(IDataFieldInfo description)
        {
            if (description == null)
            {
                throw new ArgumentNullException(nameof(description));
            }

            return(new PropertyGroupDescription()
            {
                PropertyName = description.Name
            });
        }
Пример #7
0
        /// <inheritdoc />
        internal override SortDescription GetSortDescriptionForFieldDescription(IDataFieldInfo description)
        {
            if (description == null)
            {
                throw new ArgumentNullException("description");
            }

            return(new PropertySortDescription()
            {
                PropertyName = description.Name
            });
        }
Пример #8
0
        public bool Equals(IDataFieldInfo info)
        {
            var propertyField = info as TypedDictionaryFieldInfo;

            if (propertyField == null)
            {
                return(false);
            }

            return(string.Compare(_name, propertyField._name, StringComparison.OrdinalIgnoreCase) == 0 &&
                   _dataType.Equals(propertyField._dataType));
        }
Пример #9
0
        public bool Equals(IDataFieldInfo info)
        {
            // TODO:
            return(false);

            ////var expandoField = info as ExpandoObjectFieldInfo;
            ////if (expandoField == null)
            ////{
            ////    return false;
            ////}

            ////return this.name == expandoField.Name;
        }
Пример #10
0
        private void UpdatePropertyInfo(string path)
        {
            if (this.propertyInfo == null)
            {
                return;
            }

            if (this.propertyInfo.Name != path)
            {
                if (this.Model != null && this.Model.FieldInfoData != null)
                {
                    this.propertyInfo = this.Model.FieldInfoData.GetFieldDescriptionByMember(this.PropertyName);
                }
                this.UpdateHeader();
            }
        }
Пример #11
0
        public bool Equals(IDataFieldInfo info)
        {
            var expandoField = info as ExpandoObjectFieldInfo;

            if (expandoField == null)
            {
                return(false);
            }

            if (this.name != expandoField.Name)
            {
                return(false);
            }

            return(this.dataType == expandoField.dataType);
        }
Пример #12
0
        /// <inheritdoc />
        internal override IGroupDescription GetGroupDescriptionForFieldDescription(IDataFieldInfo description)
        {
            if (description == null)
            {
                throw new ArgumentNullException(nameof(description));
            }

            ////if (FieldInfoHelper.IsNumericType(description.DataType))
            ////{
            ////    return new DoubleGroupDescription() { PropertyName = description.Name };
            ////}

            ////if (description.DataType == typeof(DateTime) || description.DataType == typeof(Nullable<DateTime>))
            ////{
            ////    return new DateTimeGroupDescription() { PropertyName = description.Name };
            ////}

            return(new PropertyGroupDescription()
            {
                PropertyName = description.Name
            });
        }
Пример #13
0
        private void SetPropertyInfo()
        {
            string propertyName = this.PropertyName;

            this.PropertyInfo = this.Model.FieldInfoData.GetFieldDescriptionByMember(propertyName);
            int dotIndex = propertyName.IndexOf(".");

            if (this.propertyInfo == null && dotIndex != -1)
            {
                string parentPath = propertyName.Substring(0, dotIndex);

                var parentFieldInfo = this.Model.FieldInfoData.GetFieldDescriptionByMember(parentPath);
                if (parentFieldInfo != null)
                {
                    IDataFieldInfo info = GridModel.InitializePropertyInfo(propertyName, parentFieldInfo.DataType, parentFieldInfo.RootClassType);
                    if (info != null)
                    {
                        this.PropertyInfo = info;
                        this.Model.FieldInfoData.AddFieldInfoToCache(info);
                    }
                }
            }
        }
Пример #14
0
 internal static void UpdateFilterMemberAccess(IFieldInfoData data, IEnumerable <FilterDescriptorBase> descriptors)
 {
     foreach (var filterDescriptor in descriptors)
     {
         var propertyFilterDescriptor = filterDescriptor as PropertyFilterDescriptor;
         if (propertyFilterDescriptor != null)
         {
             IDataFieldInfo field = data.GetFieldDescriptionByMember(propertyFilterDescriptor.PropertyName);
             if (field != null)
             {
                 propertyFilterDescriptor.MemberAccess = field as IMemberAccess;
             }
         }
         else
         {
             var compositeFilter = filterDescriptor as CompositeFilterDescriptor;
             if (compositeFilter != null)
             {
                 UpdateFilterMemberAccess(data, compositeFilter.Descriptors);
             }
         }
     }
 }
Пример #15
0
 private void UpdateColumnFieldInfo(FieldInfoNode fieldInfoNode)
 {
     foreach (var column in this.columns)
     {
         var typedColumn = column as DataGridTypedColumn;
         if (typedColumn != null && !typedColumn.IsAutoGenerated)
         {
             IDataFieldInfo fieldInfo = fieldInfoNode.FieldInfo;
             if (typedColumn.PropertyName == fieldInfo.Name)
             {
                 typedColumn.PropertyInfo = fieldInfoNode.FieldInfo;
             }
             else if (typedColumn.PropertyName.Contains(NestedPropertySeparator))
             {
                 IDataFieldInfo info = GridModel.InitializePropertyInfo(typedColumn.PropertyName, fieldInfo.DataType, fieldInfo.RootClassType);
                 if (info != null)
                 {
                     typedColumn.PropertyInfo = info;
                     this.FieldInfoData.AddFieldInfoToCache(info);
                 }
             }
         }
     }
 }
Пример #16
0
 /// <inheritdoc />
 internal abstract IGroupDescription GetGroupDescriptionForFieldDescription(IDataFieldInfo description);
Пример #17
0
 public void AddFieldInfoToCache(IDataFieldInfo fieldInfo)
 {
 }
Пример #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldInfoNode"/> class.
 /// </summary>
 /// <param name="info">The <see cref="IDataFieldInfo"/> associated with this node.</param>
 public FieldInfoNode(IDataFieldInfo info)
     : base(info.Name, info.DisplayName, ContainerNodeRole.Selectable)
 {
     this.FieldInfo = info;
 }
Пример #19
0
 IAggregateDescription IDataProvider.GetAggregateDescriptionForFieldDescription(IDataFieldInfo description)
 {
     return(this.GetAggregateDescriptionForFieldDescription(description));
 }
Пример #20
0
 SortDescription IDataProvider.GetSortDescriptionForFieldDescription(IDataFieldInfo description)
 {
     return(this.GetSortDescriptionForFieldDescription(description));
 }
Пример #21
0
 public IAggregateDescription GetAggregateDescriptionForFieldDescription(IDataFieldInfo description)
 {
     throw new NotImplementedException();
 }
Пример #22
0
 /// <inheritdoc />
 internal abstract SortDescription GetSortDescriptionForFieldDescription(IDataFieldInfo description);
Пример #23
0
 /// <inheritdoc />
 internal abstract FilterDescription GetFilterDescriptionForFieldDescription(IDataFieldInfo description);
Пример #24
0
        /// <inheritdoc />
        internal override IAggregateDescription GetAggregateDescriptionForFieldDescription(IDataFieldInfo description)
        {
            if (description == null)
            {
                throw new ArgumentNullException(nameof(description));
            }

            var aggregateDescription = new PropertyAggregateDescription()
            {
                PropertyName = description.Name
            };

            if (!FieldInfoHelper.IsNumericType(description.DataType))
            {
                ////aggregateDescription.AggregateFunction = AggregateFunctions.Count;
            }

            return(aggregateDescription);
        }
Пример #25
0
 public SortDescription GetSortDescriptionForFieldDescription(IDataFieldInfo description)
 {
     throw new NotImplementedException();
 }
Пример #26
0
 internal override SortDescription GetSortDescriptionForFieldDescription(IDataFieldInfo description)
 {
     throw new NotImplementedException();
 }
Пример #27
0
 internal override IAggregateDescription GetAggregateDescriptionForFieldDescription(IDataFieldInfo description)
 {
     throw new NotImplementedException();
 }
Пример #28
0
 /// <inheritdoc />
 internal abstract IAggregateDescription GetAggregateDescriptionForFieldDescription(IDataFieldInfo description);
Пример #29
0
 public bool Equals(IDataFieldInfo info)
 {
     return(false);
 }
Пример #30
0
 /// <summary>
 /// Deep copies content from src instance to this.
 /// <param name="source">Source for copy.</param>
 /// <returns>this.</returns>
 /// </summary>
 protected override IRecordInterface CopyFromImpl(IRecordInfo source)
 {
     base.CopyFromImpl(source);
     if (typeof(IRecordClassDescriptorInfo).IsInstanceOfType(source))
     {
         IRecordClassDescriptorInfo typedSource = ((IRecordClassDescriptorInfo)(source));
         if ((typedSource.Parent != null))
         {
             if (((this.Parent == null) ||
                  (this.Parent.GetType() == typedSource.Parent.GetType())))
             {
                 this.Parent = ((RecordClassDescriptor)(typedSource.Parent.Clone()));
             }
             else
             {
                 this.Parent.CopyFrom(typedSource.Parent);
             }
         }
         else
         {
             this.Parent = null;
         }
         if ((typedSource.HasIsAbstract() == true))
         {
             this.IsAbstract = typedSource.IsAbstract;
         }
         else
         {
             this.NullifyIsAbstract();
         }
         if ((typedSource.HasIsContentClass() == true))
         {
             this.IsContentClass = typedSource.IsContentClass;
         }
         else
         {
             this.NullifyIsContentClass();
         }
         if ((typedSource.DataFields != null))
         {
             this.DataFields = new List <IDataFieldInterface>(typedSource.DataFields.Count);
             int i;
             for (i = 0; (i < typedSource.DataFields.Count); i = (i + 1))
             {
                 IDataFieldInfo item = typedSource.DataFields[i];
                 if ((item == null))
                 {
                     this.DataFields.Add(null);
                 }
                 else
                 {
                     this.DataFields.Add(((IDataFieldInterface)(item.Clone())));
                 }
             }
         }
         else
         {
             this.DataFields = null;
         }
     }
     return(this);
 }