Пример #1
0
 public MetadataValueProvider(
     IKeyAccessor keyAccess,
     DocumentMetadataProvider metadataProvider,
     Func <DocumentMetadata, object> getter,
     Action <DocumentMetadata, object> setter)
 {
     KeyAccess        = keyAccess;
     MetadataProvider = metadataProvider;
     Getter           = getter;
     Setter           = setter;
 }
Пример #2
0
        public MetadataValueProviderCache(DocumentMetadataProvider metadataProvider, IKeyAccessor keyAccess)
        {
            MetadataProvider = metadataProvider;
            KeyAccess        = keyAccess;
            ValueProviders   = new ExclusiveConcurrentDictionary <string, MetadataValueProvider>();
            Readers          = new Dictionary <string, Func <DocumentMetadata, object> >()
            {
                { "_id", x => x._id },
                { "_rev", x => x._rev },
                { "_attachments", x => x._attachments },
            };

            Writers = new Dictionary <string, Action <DocumentMetadata, object> >()
            {
                { "_id", (x, v) => x._id = v.ToString() },
                { "_rev", (x, v) => x._rev = v.ToString() },
                { "_attachments", (x, v) => x._attachments = (JObject)v },
            };
        }