示例#1
0
        static void CreateIndexes(WorkflowPersistenceProvider instance)
        {
            if (!indexesCreated)
            {
                instance.WorkflowInstances.Indexes.CreateOne(new CreateIndexModel<WorkflowInstance>(
                    Builders<WorkflowInstance>.IndexKeys.Ascending(x => x.NextExecution),
                    new CreateIndexOptions { Background = true, Name = "idx_nextExec" }));

                instance.Events.Indexes.CreateOne(new CreateIndexModel<Event>(
                    Builders<Event>.IndexKeys
                        .Ascending(x => x.EventName)
                        .Ascending(x => x.EventKey)
                        .Ascending(x => x.EventTime),
                    new CreateIndexOptions { Background = true, Name = "idx_namekey" }));

                instance.Events.Indexes.CreateOne(new CreateIndexModel<Event>(
                    Builders<Event>.IndexKeys.Ascending(x => x.IsProcessed),
                    new CreateIndexOptions { Background = true, Name = "idx_processed" }));

                instance.EventSubscriptions.Indexes.CreateOne(new CreateIndexModel<EventSubscription>(
                    Builders<EventSubscription>.IndexKeys
                        .Ascending(x => x.EventName)
                        .Ascending(x => x.EventKey),
                    new CreateIndexOptions { Background = true, Name = "idx_namekey" }));

                indexesCreated = true;
            }
        }
 static void CreateIndexes(WorkflowPersistenceProvider instance)
 {
     if (!indexesCreated)
     {
         instance.WorkflowInstances.Indexes.CreateOne(Builders <WorkflowInstance> .IndexKeys.Ascending(x => x.NextExecution), new CreateIndexOptions()
         {
             Background = true, Name = "idx_nextExec"
         });
         instance.Events.Indexes.CreateOne(Builders <Event> .IndexKeys.Ascending(x => x.IsProcessed), new CreateIndexOptions()
         {
             Background = true, Name = "idx_processed"
         });
         indexesCreated = true;
     }
 }