Exemple #1
0
        public AzureDocumentDbStorageEngineBuilder UseTypeMap(ISerializationTypeMap typeMap)
        {
            Guard.IsNotNull(nameof(typeMap), typeMap);
            this.typeMap = typeMap;

            return(this);
        }
        public StorageEvent ToStorageEvent(ISerializationTypeMap typeMap)
        {
            var body     = Body.ToObject(typeMap.GetTypeFromName(BodyType));
            var metadata = Metadata?.ToObject(typeMap.GetTypeFromName(MetadataType));

            return(new StorageEvent(StreamId, new EventData(EventId, body, metadata), EventNumber));
        }
Exemple #3
0
 internal AzureDocumentDbStorageEngine(DocumentClient client, string databaseName, CollectionOptions collectionOptions, LoggingOptions loggingOptions, ISerializationTypeMap typeMap)
 {
     this.client            = client;
     this.databaseName      = databaseName;
     this.collectionOptions = collectionOptions;
     this.commitsLink       = UriFactory.CreateDocumentCollectionUri(databaseName, collectionOptions.CollectionName);
     this.storedProcLink    = UriFactory.CreateStoredProcedureUri(databaseName, collectionOptions.CollectionName, AppendStoredProcedureName);
     this.loggingOptions    = loggingOptions;
     this.typeMap           = typeMap;
 }
        public static DocumentDbStorageEvent FromStorageEvent(StorageEvent @event, ISerializationTypeMap typeMap)
        {
            var docDbEvent = new DocumentDbStorageEvent();

            docDbEvent.Id       = $"{@event.StreamId}:{@event.EventNumber}";
            docDbEvent.EventId  = @event.EventId;
            docDbEvent.Body     = JObject.FromObject(@event.EventBody);
            docDbEvent.BodyType = typeMap.GetNameFromType(@event.EventBody.GetType());
            if (@event.Metadata != null)
            {
                docDbEvent.Metadata     = JObject.FromObject(@event.Metadata);
                docDbEvent.MetadataType = typeMap.GetNameFromType(@event.Metadata.GetType());
            }
            docDbEvent.StreamId    = @event.StreamId;
            docDbEvent.EventNumber = @event.EventNumber;

            return(docDbEvent);
        }
        public static DocumentDbStorageEvent FromStorageEvent(StorageEvent @event, ISerializationTypeMap typeMap, int?documentTimeToLiveSeconds)
        {
            var docDbEvent = new DocumentDbStorageEvent
            {
                Id                = $"{@event.StreamId}:{@event.EventNumber}",
                EventId           = @event.EventId,
                Body              = JObject.FromObject(@event.EventBody),
                BodyType          = typeMap.GetNameFromType(@event.EventBody.GetType()),
                TimeToLiveSeconds = documentTimeToLiveSeconds
            };

            if (@event.Metadata != null)
            {
                docDbEvent.Metadata     = JObject.FromObject(@event.Metadata);
                docDbEvent.MetadataType = typeMap.GetNameFromType(@event.Metadata.GetType());
            }
            docDbEvent.StreamId    = @event.StreamId;
            docDbEvent.EventNumber = @event.EventNumber;

            return(docDbEvent);
        }
Exemple #6
0
 public GraphProjectionObserverFactory(DocumentClient client, DocumentCollection collectionInfo, ISerializationTypeMap typeMap)
 {
     this.client         = client;
     this.collectionInfo = collectionInfo;
     this.typeMap        = typeMap;
 }
Exemple #7
0
 public GraphProjectionObserver(DocumentClient client, DocumentCollection collection, ISerializationTypeMap typeMap)
 {
     this.client     = client;
     this.collection = collection;
     this.typeMap    = typeMap;
 }