public void GetSessionsTestNoResults() { //Arrange var mockCollectionResponse = new List <Collection>(); var collectionList = new List <Collection>(); this.cosmosClient.Setup(d => d.CreateDatabaseIfNotExistsAsync("confdb", It.IsAny <int>(), It.IsAny <RequestOptions>(), It.IsAny <CancellationToken>())).ReturnsAsync(databaseResponse.Object); cosmosClient.Setup(x => x.GetContainer(It.IsAny <string>(), It.IsAny <string>())).Returns(mockContainer.Object); var feedIteratorMock = new Mock <FeedIterator <Collection> >(); feedIteratorMock.Setup(f => f.HasMoreResults).Returns(true); var feedResponseMock = new Mock <FeedResponse <Collection> >(); feedResponseMock.Setup(x => x.GetEnumerator()).Returns(collectionList.GetEnumerator()); feedIteratorMock .Setup(f => f.ReadNextAsync(It.IsAny <CancellationToken>())) .ReturnsAsync(feedResponseMock.Object) .Callback(() => feedIteratorMock .Setup(f => f.HasMoreResults) .Returns(false)); mockContainer .Setup(c => c.GetItemQueryIterator <Collection>(It.IsAny <QueryDefinition>(), It.IsAny <string>(), It.IsAny <QueryRequestOptions>())) .Returns(feedIteratorMock.Object); //Act var cosmosService = new CosmosDBService(cosmosClient.Object, "confdb", "ConferenceSession"); var serviceResponse = cosmosService.GetSessionsAsync(string.Empty, string.Empty).Result; //Assert Assert.Equal(0, serviceResponse.Count); }
/// <summary> /// Initialises Cosmos DB client connection and container. /// </summary> /// <param name="configurationSection"></param> /// <returns></returns> private static async Task <CosmosDBService> InitialiseCosmosClientInstanceAsync(IConfigurationSection configurationSection) { // Set connection parameters string databaseName = configurationSection.GetSection("DatabaseName").Value; string containerName = configurationSection.GetSection("ContainerName").Value; string account = configurationSection.GetSection("Account").Value; string key = configurationSection.GetSection("Key").Value; // Build client and services Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder clientBuilder = new Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder(account, key); Microsoft.Azure.Cosmos.CosmosClient client = clientBuilder.WithConnectionModeDirect().Build(); CosmosDBService dBService = new CosmosDBService(client, databaseName, containerName); // Initialise database, if required Microsoft.Azure.Cosmos.DatabaseResponse database = await client.CreateDatabaseIfNotExistsAsync(databaseName); // Build the database container await database.Database.CreateContainerIfNotExistsAsync(containerName, "/id"); return(dBService); }
public static void GenererDonneesBase(CosmosClient client, string nomDB, string nomContainer) { var serviceOperationRecharge = new CosmosDBService <OperationRecharge>(client, nomDB, nomContainer); if (serviceOperationRecharge.GetItemsAsync("select * from c").GetAwaiter().GetResult().ToList().Count == 0) { InsertFakeDataInDb(client, nomDB, nomContainer); } }
private static void SaveBornes(List <Borne> bornes, CosmosClient client, string nomDB, string nomContainer) { CosmosDBService <Borne> serviceBorne = new CosmosDBService <Borne>(client, nomDB, nomContainer); foreach (var borne in bornes) { serviceBorne.AjouterItemAsync(borne).GetAwaiter().GetResult(); } }
private static void SaveUsager(List <Usager> usagers, CosmosClient client, string nomDB, string nomContainer) { CosmosDBService <Usager> serviceUsager = new CosmosDBService <Usager>(client, nomDB, nomContainer); foreach (var usager in usagers) { serviceUsager.AjouterItemAsync(usager).GetAwaiter().GetResult(); } }
private static void SaveOperationRecharge(List <OperationRecharge> operationRecharges, CosmosClient client, string nomDB, string nomContainer) { CosmosDBService <OperationRecharge> serviceOperationRecharge = new CosmosDBService <OperationRecharge>(client, nomDB, nomContainer); foreach (var op in operationRecharges) { serviceOperationRecharge.AjouterItemAsync(op).GetAwaiter().GetResult(); } }
private static void SaveIncidents(List <Incident> incidents, CosmosClient client, string nomDB, string nomContainer) { CosmosDBService <Incident> serviceIncident = new CosmosDBService <Incident>(client, nomDB, nomContainer); foreach (var ic in incidents) { serviceIncident.AjouterItemAsync(ic).GetAwaiter().GetResult(); } }
private static void SaveEntretiens(List <Entretien> entretiens, CosmosClient client, string nomDB, string nomContainer) { CosmosDBService <Entretien> serviceEntretien = new CosmosDBService <Entretien>(client, nomDB, nomContainer); foreach (var e in entretiens) { serviceEntretien.AjouterItemAsync(e).GetAwaiter().GetResult(); } }
private async void DeleteDogFromListAction(object obj) { Debug.WriteLine("DELETE DOG FROM LIST ACTION"); var myItem = obj as Dog; _observableCollectionOfDogs.Remove(myItem); var myCosmosDog = DogConverter.ConvertToCosmosDog(myItem); await CosmosDBService.DeleteCosmosDogAsync(myCosmosDog); }
public void ParseCosmosDBContainerResourceId() { var cosmosDBContainerResourceId = "/subscriptions/a4ed7b9a-0000-49b4-a6ee-fd07ff6e296d/resourceGroups/aspnetmplt/providers/Microsoft.DocumentDB/databaseAccounts/cosmos-aspnetmplt-cd/apis/sql/databases/ComputedSums/containers/ComputedSumsCtr"; CosmosDBService.ParseCosmosDBContainerResourceId( cosmosDBContainerResourceId, out string cosmosDBResourceId, out string cosmosDBDatabase, out string cosmosDBContainer); Assert.Equal("/subscriptions/a4ed7b9a-0000-49b4-a6ee-fd07ff6e296d/resourceGroups/aspnetmplt/providers/Microsoft.DocumentDB/databaseAccounts/cosmos-aspnetmplt-cd", cosmosDBResourceId); Assert.Equal("ComputedSums", cosmosDBDatabase); Assert.Equal("ComputedSumsCtr", cosmosDBContainer); }
private static async Task <CosmosDBService> InitializeCosmosClientInstanceAsync(CosmosDb settings) { databaseName = settings.DatabaseName; containerName = settings.ContainerName; account = settings.Account; key = settings.Key; CosmosClient client = new CosmosClient(account, key); CosmosDBService cosmosDBService = new CosmosDBService(client, databaseName, containerName); DatabaseResponse database = await client.CreateDatabaseIfNotExistsAsync(databaseName); await database.Database.CreateContainerIfNotExistsAsync(containerName, "/__partitionKey"); return(cosmosDBService); }
/// <summary> /// Creates a Cosmos DB database and a container with the specified partition key. /// </summary> /// <returns></returns> private static async Task <CosmosDBService> InitializeCosmosClientInstanceAsync(IConfigurationSection configurationSection) { string databaseName = configurationSection.GetSection("DatabaseName").Value; string containerName = configurationSection.GetSection("ContainerName").Value; string account = configurationSection.GetSection("Account").Value; string key = configurationSection.GetSection("Key").Value; Microsoft.Azure.Cosmos.CosmosClient client = new Microsoft.Azure.Cosmos.CosmosClient(account, key); CosmosDBService cosmosDbService = new CosmosDBService(client, databaseName, containerName); Microsoft.Azure.Cosmos.DatabaseResponse database = await client.CreateDatabaseIfNotExistsAsync(databaseName); await database.Database.CreateContainerIfNotExistsAsync(containerName, "/id"); return(cosmosDbService); }
/// Creates a Cosmos DB database and a container with the specified partition key. private static CosmosDBService InitializeCosmosClientInstanceAsync(IConfigurationSection configurationSection) { string databaseName = configurationSection.GetSection("DatabaseName").Value; string containerName = configurationSection.GetSection("ContainerName").Value; string account = configurationSection.GetSection("Account").Value; string key = configurationSection.GetSection("Key").Value; Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder clientBuilder = new Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder(account, key); Microsoft.Azure.Cosmos.CosmosClient client = clientBuilder .WithConnectionModeDirect() .Build(); CosmosDBService cosmosDbService = new CosmosDBService(client, databaseName); client.CreateDatabaseIfNotExistsAsync(databaseName); return(cosmosDbService); }
private async void DeleteDogFromListAction(object obj) { Debug.WriteLine("DELETE DOG FROM LIST ACTION"); var myItem = obj as Dog; Debug.WriteLine($"Removing dog {myItem}"); if (_observableCollectionOfDogs.Remove(myItem)) { var myCosmosDog = DogConverter.ConvertToCosmosDog(myItem); await CosmosDBService.DeleteCosmosDogAsync(myCosmosDog); } else { Debug.WriteLine($"Dog not reomved from observable collection {myItem}"); } }
private static async Task <CosmosDBService> InitializeCosmosClientInstanceAsync(IConfigurationSection configurationSection) { string databaseName = configurationSection.GetSection("DatabaseName").Value; string containerName = configurationSection.GetSection("ContainerName").Value; string account = configurationSection.GetSection("Account").Value; string key = configurationSection.GetSection("Key").Value; CosmosClientBuilder clientBuilder = new CosmosClientBuilder(account, key); CosmosClient client = clientBuilder .WithConnectionModeDirect() .Build(); CosmosDBService cosmosDbService = new CosmosDBService(client, databaseName, containerName); DatabaseResponse database = await client.CreateDatabaseIfNotExistsAsync(databaseName); await database.Database.CreateContainerIfNotExistsAsync(containerName, "/id"); return(cosmosDbService); }
public void GetSessionsTestWithResults() { //Arrange string mockResponse = "[{'Items':{'href':'https://conferenceapi.azurewebsites.net/session/101','data':[{'name':'Title','value':'\r\n\t\t\tAsync in C# 5\r\n\t\t'},{'name':'Timeslot','value':'04 December 2013 10:20 - 11:20'},{'name':'Speaker','value':'Jon Skeet'}],'links':[{'rel':'http://tavis.net/rels/speaker','href':'https://conferenceapi.azurewebsites.net/speaker/6'},{'rel':'http://tavis.net/rels/topics','href':'https://conferenceapi.azurewebsites.net/session/101/topics'}]}},{'Items':{'href':'https://conferenceapi.azurewebsites.net/session/127','data':[{'name':'Title','value':'\r\n\t\t\tSemantics matter\r\n\t\t'},{'name':'Timeslot','value':'04 December 2013 15:00 - 16:00'},{'name':'Speaker','value':'Jon Skeet'}],'links':[{'rel':'http://tavis.net/rels/speaker','href':'https://conferenceapi.azurewebsites.net/speaker/6'},{'rel':'http://tavis.net/rels/topics','href':'https://conferenceapi.azurewebsites.net/session/127/topics'}]}},{'Items':{'href':'https://conferenceapi.azurewebsites.net/session/133','data':[{'name':'Title','value':'\r\n\t\t\tLearning from Noda Time: a case study in API design and open source (good, bad and ugly)\r\n\t\t'},{'name':'Timeslot','value':'04 December 2013 16:20 - 17:20'},{'name':'Speaker','value':'Jon Skeet'}],'links':[{'rel':'http://tavis.net/rels/speaker','href':'https://conferenceapi.azurewebsites.net/speaker/6'},{'rel':'http://tavis.net/rels/topics','href':'https://conferenceapi.azurewebsites.net/session/133/topics'}]}}]"; var mockCollectionResponse = JsonConvert.DeserializeObject <ICollection <Collection> > (mockResponse); var collectionList = new List <Collection>(); collectionList.AddRange(mockCollectionResponse); this.cosmosClient.Setup(d => d.CreateDatabaseIfNotExistsAsync("confdb", It.IsAny <int>(), It.IsAny <RequestOptions>(), It.IsAny <CancellationToken>())).ReturnsAsync(databaseResponse.Object); cosmosClient.Setup(x => x.GetContainer(It.IsAny <string>(), It.IsAny <string>())).Returns(mockContainer.Object); var feedIteratorMock = new Mock <FeedIterator <Collection> >(); feedIteratorMock.Setup(f => f.HasMoreResults).Returns(true); var feedResponseMock = new Mock <FeedResponse <Collection> >(); feedResponseMock.Setup(x => x.GetEnumerator()).Returns(collectionList.GetEnumerator()); feedIteratorMock .Setup(f => f.ReadNextAsync(It.IsAny <CancellationToken>())) .ReturnsAsync(feedResponseMock.Object) .Callback(() => feedIteratorMock .Setup(f => f.HasMoreResults) .Returns(false)); mockContainer .Setup(c => c.GetItemQueryIterator <Collection>(It.IsAny <QueryDefinition>(), It.IsAny <string>(), It.IsAny <QueryRequestOptions>())) .Returns(feedIteratorMock.Object); //Act var cosmosService = new CosmosDBService(cosmosClient.Object, "confdb", "ConferenceSession"); var serviceResponse = cosmosService.GetSessionsAsync(string.Empty, string.Empty).Result; //Assert Assert.Equal(mockCollectionResponse.Count, serviceResponse.Count); }
private static async Task <CosmosDBService> InitializeCosmosClientInstanceAsync(IConfiguration Configuration) { // CosmosDB connection information string account = Configuration["CosmosDB:Account"]; string key = Configuration["CosmosDB:Key"]; // CosmosDB database string databaseName = Configuration["CosmosDB:DatabaseName"]; // CosmosDB containers var containerNames = Configuration .AsEnumerable() .Where(o => o.Key.Contains("CosmosDB:ContainerName:")) .Select(o => o.Value) .ToList(); // initialize CosmosDB client Microsoft.Azure.Cosmos.CosmosClient client = new Microsoft.Azure.Cosmos.CosmosClient(account, key); // create database if missing Microsoft.Azure.Cosmos.DatabaseResponse database = await client.CreateDatabaseIfNotExistsAsync(databaseName); // initialize service CosmosDBService cosmosDbService = new CosmosDBService(client); // for each container in list: containerNames.ForEach(async containerName => { // create container inside database, if missing await database.Database.CreateContainerIfNotExistsAsync(containerName, "/id"); // add container to the list inside service await cosmosDbService.AddContainerDefinition(databaseName, containerName); }); // Do nothing. Satisfy debugger's requirement to have "await" in it //await Task.Run(() => {}); return(cosmosDbService); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddOData(); services.AddControllers(mvcOptions => mvcOptions.EnableEndpointRouting = false); IConfigurationSection configurationSection = Configuration.GetSection("CosmosDb"); string databaseName = configurationSection.GetSection("DatabaseName").Value; string containerName = configurationSection.GetSection("ContainerName").Value; string account = configurationSection.GetSection("Account").Value; string key = configurationSection.GetSection("Key").Value; CosmosClientBuilder clientBuilder = new CosmosClientBuilder(account, key); CosmosClient client = clientBuilder .WithConnectionModeDirect() .Build(); DatabaseResponse database = client.CreateDatabaseIfNotExistsAsync(databaseName).GetAwaiter().GetResult(); database.Database.CreateContainerIfNotExistsAsync(containerName, "/entity").GetAwaiter().GetResult(); CosmosDBService <Journey> journeyService = new CosmosDBService <Journey>(client, databaseName, containerName); services.AddSingleton <ICosmosDBService <Journey> >(journeyService); CosmosDBService <Driver> driverService = new CosmosDBService <Driver>(client, databaseName, containerName); services.AddSingleton <ICosmosDBService <Driver> >(driverService); CosmosDBService <Location> locationService = new CosmosDBService <Location>(client, databaseName, containerName); services.AddSingleton <ICosmosDBService <Location> >(locationService); CosmosDBService <Vehicle> vehicleService = new CosmosDBService <Vehicle>(client, databaseName, containerName); services.AddSingleton <ICosmosDBService <Vehicle> >(vehicleService); services.AddControllers(); BaseDataService.GenerateBaseData(client, databaseName, containerName); StartChangeFeedProcessorAsync(client, Configuration).GetAwaiter().GetResult();; }
public CompanyController(CosmosDBService cosmosDbService) { _cosmosDbService = cosmosDbService; }
public EmployeeController(CosmosDBService cosmosDbService) { _cosmosDbService = cosmosDbService; }
public static void GenererDonneesBase(CosmosClient client, string nomDB, string nomContainer) { Station station = new Station() { Latitude = "33.7866", Longitude = "-118.2987", AdresseRue = "5 rue de Beverly hills", AdresseVille = "Hill Valey", CodePostal = "90210" }; TypeCharge tc1 = new TypeCharge() { Libelle = "efficace et sûre", Puissance = 5.4F }; TypeCharge tc2 = new TypeCharge() { Libelle = "faut se mefier", Puissance = 152.2F }; List <TypeCharge> typesCharge = new List <TypeCharge> { tc1, tc2 }; Borne borne = new Borne() { DateMiseEnService = new DateTime(1955, 11, 5), DateDerniereRevision = new DateTime(1985, 10, 26), Station = station, TypeCharge = typesCharge, Id = Guid.NewGuid(), Document = "borne" }; CosmosDBService <Borne> serviceBorne = new CosmosDBService <Borne>(client, nomDB, nomContainer); serviceBorne.AjouterItemAsync(borne).GetAwaiter().GetResult(); // Usager Abonnement abonnement = new Abonnement() { DateDebut = new DateTime(1970, 5, 15), DateFin = new DateTime(2020, 6, 23) }; ForfaitPrepaye forfaitPrepaye = new ForfaitPrepaye() { SoldeKwHeures = "20.5" }; ModeleBatterie modeleBatterie = new ModeleBatterie() { Fabricant = "Toyota", Capacite = 100F }; Contrat contrat = new Contrat() { DateContrat = new DateTime(1970, 5, 15), NoImmatriculation = "56-BDG-99", Abonnement = abonnement, ForfaitPrepaye = forfaitPrepaye, ModeleBatterie = modeleBatterie }; Usager usager = new Usager() { Id = Guid.NewGuid(), Document = "usager", Nom = "Delamarre", Prenom = "Théo", Adresse = "56 rue des peupliers", Ville = "Roulard", CodePostal = "56892", TelFixe = "03.56.25.22.22", TelMobile = "06.88.99.88.88", Contrat = contrat }; var serviceUsager = new CosmosDBService <Usager>(client, nomDB, nomContainer); serviceUsager.AjouterItemAsync(usager).GetAwaiter().GetResult(); // Opération Recharge Controle controle1 = new Controle() { Libelle = "Prise", Notes = "La prise à une patte cassée" }; Controle controle2 = new Controle() { Libelle = "Disque Dur", Notes = "Disque Dur Plein" }; Controle controle3 = new Controle() { Libelle = "Appareil Carte", Notes = "Lecteur de carte défectueux" }; Controle controle4 = new Controle() { Libelle = "Routeur", Notes = "Routeur HS" }; List <Controle> listControle1 = new List <Controle> { controle1, controle2 }; List <Controle> listControle2 = new List <Controle> { controle3, controle4 }; List <Controle> listControle3 = new List <Controle> { controle1, controle3 }; List <Controle> listControle4 = new List <Controle> { controle2, controle4 }; OperationRecharge operationRecharge1 = new OperationRecharge() { Id = Guid.NewGuid(), Document = "operation-recharge", DateHeureDebut = new DateTime(1999, 5, 11), DateHeureFin = new DateTime(1999, 5, 12), NbKwHeures = 2.04F, Borne = borne, NoContrat = "1L", Usager = usager, Controle = listControle1, DemandeEntretien = true }; OperationRecharge operationRecharge2 = new OperationRecharge() { Id = Guid.NewGuid(), Document = "operation-recharge", DateHeureDebut = new DateTime(1970, 5, 11), DateHeureFin = new DateTime(1970, 5, 12), NbKwHeures = 1.04F, Borne = borne, NoContrat = "2L", Usager = usager, Controle = listControle2, DemandeEntretien = true }; OperationRecharge operationRecharge3 = new OperationRecharge() { Id = Guid.NewGuid(), Document = "operation-recharge", DateHeureDebut = new DateTime(2000, 5, 11), DateHeureFin = new DateTime(2000, 5, 12), NbKwHeures = 6F, Borne = borne, NoContrat = "3L", Usager = usager, Controle = listControle3, DemandeEntretien = true }; OperationRecharge operationRecharge4 = new OperationRecharge() { Id = Guid.NewGuid(), Document = "operation-recharge", DateHeureDebut = new DateTime(2016, 9, 11), DateHeureFin = new DateTime(2016, 9, 12), NbKwHeures = 2.04F, Borne = borne, NoContrat = "4L", Usager = usager, Controle = listControle4, DemandeEntretien = true }; var serviceOperationRecharge = new CosmosDBService <OperationRecharge>(client, nomDB, nomContainer); serviceOperationRecharge.AjouterItemAsync(operationRecharge1).GetAwaiter().GetResult(); serviceOperationRecharge.AjouterItemAsync(operationRecharge2).GetAwaiter().GetResult(); serviceOperationRecharge.AjouterItemAsync(operationRecharge3).GetAwaiter().GetResult(); serviceOperationRecharge.AjouterItemAsync(operationRecharge4).GetAwaiter().GetResult(); //Service Incident Incident incident1 = new Incident() { Details = "Prise et Disque dur", OperationRecharge = operationRecharge1, Id = Guid.NewGuid(), Document = "incident" }; Incident incident2 = new Incident() { Details = "Appareil Carte et Routeur", OperationRecharge = operationRecharge2, Id = Guid.NewGuid(), Document = "incident" }; Incident incident3 = new Incident() { Details = "Prise et Appareil Carte", OperationRecharge = operationRecharge3, Id = Guid.NewGuid(), Document = "incident" }; Incident incident4 = new Incident() { Details = "Routeur et Disque dur", OperationRecharge = operationRecharge4, Id = Guid.NewGuid(), Document = "incident" }; var serviceIncident = new CosmosDBService <Incident>(client, nomDB, nomContainer); serviceIncident.AjouterItemAsync(incident1).GetAwaiter().GetResult(); serviceIncident.AjouterItemAsync(incident2).GetAwaiter().GetResult(); serviceIncident.AjouterItemAsync(incident3).GetAwaiter().GetResult(); serviceIncident.AjouterItemAsync(incident4).GetAwaiter().GetResult(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Auto Mapper var mapperConfig = new MapperConfiguration(config => { config.AddProfile <BorneProfile>(); config.AddProfile <OperationRechargeProfile>(); config.AddProfile <UsagerProfile>(); config.AddProfile <IncidentProfile>(); config.AddProfile <EntretienProfile>(); config.AddProfile <IncidentMonthlyAverageProfile>(); config.AddProfile <TopFiveElementsDefectueuxProfile>(); config.AddProfile <AverageElementFunctionnementProfile>(); }); services.AddAutoMapper(typeof(Startup)); // Configuration CosmosDB IConfigurationSection configurationSection = Configuration.GetSection("CosmosDB"); string nomDB = configurationSection.GetSection("nomDB").Value; string nomContainer = configurationSection.GetSection("nomContainer").Value; string compte = configurationSection.GetSection("compte").Value; string cle = configurationSection.GetSection("cle").Value; CosmosClientBuilder clientBuilder = new CosmosClientBuilder(compte, cle); CosmosClient client = clientBuilder .WithConnectionModeDirect() .Build(); // Création effective de la BDD DatabaseResponse db = client.CreateDatabaseIfNotExistsAsync(nomDB).GetAwaiter().GetResult(); // Création du container db.Database.CreateContainerIfNotExistsAsync(nomContainer, "/id").GetAwaiter().GetResult(); // Création et enregistrement des services par injection de dépendances CosmosDBService <Borne> serviceBorne = new CosmosDBService <Borne>(client, nomDB, nomContainer); services.AddSingleton <ICosmosDBService <Borne> >(serviceBorne); CosmosDBService <OperationRecharge> serviceOperationRecharge = new CosmosDBService <OperationRecharge>(client, nomDB, nomContainer); services.AddSingleton <ICosmosDBService <OperationRecharge> >(serviceOperationRecharge); CosmosDBService <Usager> serviceUsager = new CosmosDBService <Usager>(client, nomDB, nomContainer); services.AddSingleton <ICosmosDBService <Usager> >(serviceUsager); CosmosDBService <Incident> serviceIncident = new CosmosDBService <Incident>(client, nomDB, nomContainer); services.AddSingleton <ICosmosDBService <Incident> >(serviceIncident); CosmosDBService <Entretien> serviceEntretien = new CosmosDBService <Entretien>(client, nomDB, nomContainer); services.AddSingleton <ICosmosDBService <Entretien> >(serviceEntretien); SpecificsCosmosService <StatElementDefectueux> serviceTopFiveElementsDefectives = new SpecificsCosmosService <StatElementDefectueux>(client, nomDB, nomContainer); services.AddSingleton(serviceTopFiveElementsDefectives); SpecificsCosmosService <ChangementElements> serviceChangementElements = new SpecificsCosmosService <ChangementElements>(client, nomDB, nomContainer); services.AddSingleton(serviceChangementElements); SpecificsCosmosService <NombreBorne> serviceNbBornes = new SpecificsCosmosService <NombreBorne>(client, nomDB, nomContainer); services.AddSingleton(serviceNbBornes); services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "E-Bis Maintenance API", Version = "v0.0.1" }); }); // Décommenter pour garnir la bdd ServiceDonneesBase.GenererDonneesBase(client, nomDB, nomContainer); //ServiceDonneesBaseIncident.GenererDonneesBase(client, nomDB, nomContainer); }