Esempio n. 1
0
 public void SetCollectionIdFormatter(ICollectionIdFormatter collectionIdFormatter)
 {
     if (collectionIdFormatter == null)
     {
         throw new ArgumentNullException(nameof(collectionIdFormatter));
     }
     SetCollectionIdFormatter(_ => collectionIdFormatter);
 }
        public static ISagaRepository <TSaga> Create(CosmosClient client, string databaseName, ICollectionIdFormatter collectionIdFormatter)
        {
            if (collectionIdFormatter == null)
            {
                throw new ArgumentNullException(nameof(collectionIdFormatter));
            }

            var databaseContext = new CosmosDatabaseContext <TSaga>(client.GetContainer(databaseName, collectionIdFormatter.Saga <TSaga>()));

            var consumeContextFactory = new SagaConsumeContextFactory <DatabaseContext <TSaga>, TSaga>();

            var repositoryFactory = new CosmosSagaRepositoryContextFactory <TSaga>(databaseContext, consumeContextFactory);

            return(new SagaRepository <TSaga>(repositoryFactory));
        }