Exemple #1
0
        /// <summary>
        /// Finds all field types (e.g. StringField).
        /// Looks up their xsdType property and stores the results into the _fieldTypeToXsdType dictionary.
        /// </summary>
        private void FindFieldTypes()
        {
            _fieldTypeToXsdType = new Dictionary <Entity, string>();
            var fieldTypes = _schemaManager.GetInstancesOfType(A(Aliases.FieldType));

            foreach (var fieldType in fieldTypes)
            {
                string xsdType = _schemaManager.GetStringFieldValue(fieldType, Aliases2.XsdType);
                if (xsdType != null)
                {
                    _fieldTypeToXsdType.Add(fieldType, xsdType);
                }
            }
        }
Exemple #2
0
        /// <summary>
        ///     Gets the fields with defaults.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        private IEnumerable <FieldData> GetFieldsWithDefaults(Entity type)
        {
            List <FieldData> result;

            if (!_defaultsOnType.TryGetValue(type, out result))
            {
                Alias defaultValueAlias = Aliases.CoreAlias("defaultValue");

                result =
                    (from ancType in SchemaResolver.GetAncestors(type)
                     from field in SchemaResolver.GetDeclaredFields(ancType)
                     let defaultValue = SchemaResolver.GetStringFieldValue(field, defaultValueAlias)
                                        where defaultValue != null
                                        select new FieldData
                {
                    Field = field,
                    Value = defaultValue
                }).ToList( );

                _defaultsOnType[type] = result;
            }
            return(result);
        }