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));
        }
 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);
     configuration(configurer);
     _fields.Add(configurer.Build());
     return this;
 }
 public FieldConfigurerImpl(ContentPartFieldDefinition field)
     : base(field)
 {
     _fieldDefinition = field.FieldDefinition;
     _fieldName = field.Name;
 }
 private void Apply(ContentPartFieldDefinition model, ContentPartFieldDefinitionRecord record)
 {
     record.Settings = Compose(_settingsFormatter.Map(model.Settings));
 }
 protected ContentPartFieldDefinitionBuilder(ContentPartFieldDefinition field)
 {
     _settings = new SettingsDictionary(field.Settings.ToDictionary(kv => kv.Key, kv => kv.Value));
 }
 public IFieldStorage BindStorage(ContentPart contentPart, ContentPartFieldDefinition partFieldDefinition)
 {
     throw new NotImplementedException();
 }
 public Phi()
 {
     PartFieldDefinition = new ContentPartFieldDefinition(new ContentFieldDefinition("Phi"), "Phi", new SettingsDictionary());
 }