示例#1
0
        public ColumnDescriptor GetCollectionColumn()
        {
            var collectionInfo = DataSchema.GetCollectionInfo(PropertyType);

            if (null == collectionInfo)
            {
                return(null);
            }
            return(new Collection(this, collectionInfo));
        }
示例#2
0
        public ColumnDescriptor ResolveChild(string name)
        {
            if (PropertyType == null)
            {
                return(null);
            }
            if (name == null)
            {
                var collectionInfo = DataSchema.GetCollectionInfo(PropertyType);
                if (collectionInfo != null)
                {
                    return(new ColumnDescriptor(this, collectionInfo));
                }
            }
            var propertyDescriptor = DataSchema.GetPropertyDescriptor(PropertyType, name);

            if (propertyDescriptor == null)
            {
                return(null);
            }
            return(new ColumnDescriptor(this, propertyDescriptor));
        }
示例#3
0
文件: ViewInfo.cs 项目: zjjyyang/ftdr
        private ColumnDescriptor GetColumnDescriptor(IDictionary <IdentifierPath, ColumnSpec> columnSpecs, IdentifierPath idPath)
        {
            ColumnDescriptor columnDescriptor;

            if (_columnDescriptors.TryGetValue(idPath, out columnDescriptor))
            {
                return(columnDescriptor);
            }
            var parent = GetColumnDescriptor(columnSpecs, idPath.Parent);

            if (parent == null)
            {
                throw new InvalidOperationException("Could not resolve path " + idPath);
            }
            if (idPath.Name != null)
            {
                columnDescriptor = new ColumnDescriptor(parent, idPath.Name);
            }
            else
            {
                var collectionInfo = DataSchema.GetCollectionInfo(parent.PropertyType);
                if (collectionInfo == null)
                {
                    throw new InvalidOperationException(parent.PropertyType + " is not a collection.");
                }
                columnDescriptor = new ColumnDescriptor(parent, collectionInfo);
            }
            ColumnSpec columnSpec;

            if (columnSpecs.TryGetValue(idPath, out columnSpec))
            {
                columnDescriptor = columnDescriptor.SetColumnSpec(columnSpec);
            }
            _columnDescriptors.Add(idPath, columnDescriptor);
            return(columnDescriptor);
        }