Hello. Everyone!.
I hope you are doing well.
Need the CRUD api in asp net core 7.0 with Cosmosdb.
If someeone can help me, I appreciate that.
Hello. Everyone!.
I hope you are doing well.
Need the CRUD api in asp net core 7.0 with Cosmosdb.
If someeone can help me, I appreciate that.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vishal YelvePosted May 28, 2023, 6:47 PM
https://dev.to/francescoxx/c-c-sharp-crud-rest-api-using-net-7-aspnet-entity-framework-postgres-docker-and-docker-compose-493a
https://www.learmoreseekmore.com/2022/11/dotnet7-api-crud-efcore.html?m=1
https://jayanttripathy.com/building-crud-rest-apis-in-asp-net-core-7-0-with-ef/
https://jasonwatmore.com/net-7-dapper-ms-sql-server-crud-api-tutorial-in-aspnet-core
Mohamed Azarudeen ZPosted May 28, 2023, 11:41 AM
First, make sure you have the required NuGet packages installed: `Microsoft.Azure.Cosmos`, `Microsoft.Azure.Cosmos.Fluent`, and `Microsoft.Extensions.Configuration.AzureKeyVault`.
1. Create a `Product` class to represent your data model:
2. Create an interface to define the operations for working with the Cosmos DB:
3. Implement the `IProductRepository` interface using the Cosmos DB SDK:
4. Create a controller to handle the API endpoints:
Note: You will need to configure the Cosmos DB connection and set up dependency injection for the `CosmosClient` and `IProductRepository` in the ASP.NET Core Startup class.
That's it! You now have a basic CRUD API using Cosmos DB in ASP.NET Core 7.0. You can test the API endpoints using tools like Postman or any other HTTP client.