Example #1
0
        public static DataTypePrevalue[] GetEmbeddedContentPrevalues(this DataTypeBase dataType)
        {
            var eca = GetEmbeddedContentAttribute(dataType.GetType());

            if (eca == null)
            {
                return(new DataTypePrevalue[] { });
            }

            var id    = 1;
            var value = new StringBuilder();

            foreach (var attribute in dataType.GetType().GetProperties().Select(GetEmbeddedContentPropertyAttribute).Where(attribute => attribute != null))
            {
                attribute.Id = id;
                value.Append(attribute.Value);
                id++;
            }

            value.AppendFormat("||showLabel:{0};maxCount:{1};showType={2},showDescription={3},showTitle={4},showRequired={5},showValidation={6}",
                               BoolToInt(eca.ShowLabel),
                               eca.MaxCount,
                               BoolToInt(eca.ShowType),
                               BoolToInt(eca.ShowDescription),
                               BoolToInt(eca.ShowTitle),
                               BoolToInt(eca.ShowRequired),
                               BoolToInt(eca.ShowValidation));

            return(new[] { new DataTypePrevalue("myCustomValue", value.ToString()) });
        }