This project is a .NET Core 2 Web API designed to provide financial data, with a specific focus on commodity exchange information. It serves as a template and is a migration of concepts from the "ASP.NET Web API 2 2nd edition" book, updated to the .NET Core 2 framework.
The API aims to deliver data for capital market activists, offering insights and information related to the commodity market.
- .NET Core 2 Web API: Built on the modern, cross-platform .NET Core framework.
- AutoMapper: Utilizes AutoMapper for simplified object-to-object mappings.
- Swagger API Documentation: Integrated with Swashbuckle for generating Swagger API documentation. The documentation can be accessed at the
/swagger
endpoint. - API Versioning: Supports API versioning to manage changes and evolution of the API.
- Entity Framework Core: Uses Entity Framework Core for data access and interaction with the underlying database.
- Logging: Implements logging to file for tracking application events and errors.
The API provides endpoints for various financial data entities, including:
- Brokers: Information related to brokerage firms.
- Derivatives: Data concerning derivative products.
- Futures: Specific information about futures contracts.
- Options: Specific information about options contracts.
For a detailed description of all available endpoints, request/response models, and to try out the API, please refer to the Swagger documentation available at the /swagger
endpoint.
Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.
- .NET Core SDK (Version 2.0 or later, as specified in the project files)
- Clone the repository:
git clone https://github.com/your-username/Core2WebApi.git # Replace with the actual repository URL cd Core2WebApi
- Restore dependencies:
dotnet restore
- Build the project:
dotnet build
- Run the project:
The API will typically be available at
dotnet run
http://localhost:5000
orhttps://localhost:5001
. Check the console output when the application starts for the exact URLs.
The application uses Entity Framework Core and connects to SQL Server databases (InformingDBContext
and FutureSnapshotContext
).
- Connection Strings: You will need to configure the database connection strings. These are not found in the default
appsettings.json
. You may need to:- Add them to
appsettings.Development.json
(for local development). - Set them up via User Secrets.
- Configure them using environment variables.
- Add them to
- Database Migrations: Once connection strings are set up, you may need to apply Entity Framework migrations to create the database schema if it doesn't exist. This typically involves commands like
dotnet ef database update
. Consult the Entity Framework Core documentation for details specific to your setup.
The project follows a standard .NET Core Web API structure. Key folders include:
/Common
: Contains shared utilities, extensions, security classes, and web-related helpers./Controllers
: Houses the API controllers that handle incoming HTTP requests and route them to appropriate services./Controllers/V1
: Contains version 1 of the API controllers.
/Data
: Includes data access logic, entity definitions, query processors, and database context classes./Data/Entities
: Defines the database entities./Data/QueryProcessors
: Contains classes responsible for querying data./Data/SqlServer
: Specific implementations for SQL Server.
/LinkServices
: Contains services for generating HATEOAS links for API responses./Mapping
: Includes AutoMapper profiles for object-to-object mapping configurations./Models
: Defines the Data Transfer Objects (DTOs) used for API requests and responses./Services
: Contains business logic services that orchestrate operations, interact with data layers, and prepare data for controllers./logs
: Default directory for log files generated by the application.Program.cs
: The main entry point of the application.Startup.cs
: Configures services, dependency injection, and the HTTP request pipeline.
Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs, feature requests, or improvements.
This project is licensed under the MIT License - see the LICENSE.md
file for details (assuming MIT, please update if different).