Пример #1
0
        private static CosmosSettings GetCosmosConfiguration()
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");

            Configuration = builder.Build();

            var cosmosSettings = new CosmosSettings()
            {
                DbUrl               = Configuration.GetSection("cosmos")["DbUrl"],
                DbName              = Configuration.GetSection("cosmos")["DbName"],
                CollectionName      = Configuration.GetSection("cosmos")["CollectionName"],
                LeaseCollectionName = Configuration.GetSection("cosmos")["LeaseCollectionName"],
                AuthorizationKey    = Configuration.GetSection("cosmos")["AuthorizationKey"],
                MaxConnectionLimit  = Convert.ToInt32(Configuration.GetSection("cosmos")["MaxConnectionLimit"]),
                OfferThroughput     = Convert.ToInt32(Configuration.GetSection("cosmos")["OfferThroughput"])
            };

            return(cosmosSettings);
        }
Пример #2
0
 public static void Main(string[] args)
 {
     cosmosSettings = GetCosmosConfiguration();
     MainAsync().Wait();
 }