public IFieldStorageProvider GetProvider(ContentPartFieldDefinition partFieldDefinition) { IFieldStorageProvider provider = null; string storage; if (partFieldDefinition.Settings.TryGetValue(Storage, out storage)) provider = Locate(storage); return provider ?? Locate(DefaultProviderName); }
public IFieldStorage BindStorage(ContentPart contentPart, ContentPartFieldDefinition partFieldDefinition) { var partName = XmlConvert.EncodeLocalName(contentPart.PartDefinition.Name); var fieldName = XmlConvert.EncodeLocalName(partFieldDefinition.Name); var infosetPart = contentPart.As<InfosetPart>(); return new SimpleFieldStorage( (name, valueType) => Get(infosetPart.ContentItem.VersionRecord == null ? infosetPart.Infoset.Element : infosetPart.VersionInfoset.Element, partName, fieldName, name), (name, valueType, value) => Set(infosetPart.ContentItem.VersionRecord == null ? infosetPart.Infoset.Element : infosetPart.VersionInfoset.Element, partName, fieldName, name, value)); }
private void Apply(ContentPartFieldDefinition model, ContentPartFieldDefinitionRecord record) { record.Settings = Compose(_settingsFormatter.Map(model.Settings)); }
public ContentPartDefinitionBuilder WithField(string fieldName, Action<ContentPartFieldDefinitionBuilder> configuration) { var existingField = _fields.FirstOrDefault(x => x.Name == fieldName); if (existingField != null) { var toRemove = _fields.Where(x => x.Name == fieldName).ToArray(); foreach (var remove in toRemove) { _fields.Remove(remove); } } else { existingField = new ContentPartFieldDefinition(fieldName); } var configurer = new FieldConfigurerImpl(existingField, _part); configuration(configurer); _fields.Add(configurer.Build()); return this; }
public FieldConfigurerImpl(ContentPartFieldDefinition field, ContentPartDefinition part) : base(field) { _fieldDefinition = field.FieldDefinition; _fieldName = field.Name; _partDefinition = part; }
protected ContentPartFieldDefinitionBuilder(ContentPartFieldDefinition field) { Current = field; _settings = new SettingsDictionary(field.Settings.ToDictionary(kv => kv.Key, kv => kv.Value)); }