예제 #1
0
        public ColumnMetadata(string name, DType schema, DataFormat?dataFormat, string displayName, bool isReadOnly, bool isKey, bool isRequired,
                              ColumnCreationKind creationKind, ColumnVisibility visibility,
                              string titleColumnName, string subtitleColumnName, string thumbnailColumnName,
                              ColumnLookupMetadata?lookupMetadata, ColumnAttachmentMetadata?attachmentMetadata)
        {
            Contracts.AssertNonEmpty(name);
            Contracts.AssertValid(schema);
            Contracts.AssertOneOfValueTypeOrNull(dataFormat, DataTypeInfo.GetValidDataFormats(schema.Kind));
            Contracts.AssertNonEmpty(displayName);
            Contracts.AssertNonEmptyOrNull(titleColumnName);
            Contracts.AssertNonEmptyOrNull(subtitleColumnName);
            Contracts.AssertNonEmptyOrNull(thumbnailColumnName);
            Contracts.AssertValueOrNull(lookupMetadata);
            Contracts.AssertValueOrNull(attachmentMetadata);

            Name                = name;
            Type                = schema;
            DataFormat          = dataFormat;
            DisplayName         = displayName;
            IsReadOnly          = isReadOnly;
            IsKey               = isKey;
            IsRequired          = isRequired;
            _kind               = creationKind;
            _visibility         = visibility;
            TitleColumnName     = titleColumnName;
            SubtitleColumnName  = subtitleColumnName;
            ThumbnailColumnName = thumbnailColumnName;
            LookupMetadata      = lookupMetadata;
            AttachmentMetadata  = attachmentMetadata;

            if (dataFormat == PowerFx.Core.App.DataFormat.AllowedValues)
            {
                AllowedValues = AllowedValuesMetadata.CreateForValue(schema);
            }
        }