Giter VIP home page Giter VIP logo

rally-simulator's Introduction

Rally Simulator ๐Ÿšฒ ๐Ÿš— ๐Ÿšš


Build

Vehicle racing simulator implemented using .NET6 and a SQLite in-memory database.

Technologies

  • .NET6
  • SQLite (In-Memory)
  • Entity Framework Core 6.0
  • Dapper
  • Dynamic LINQ
  • MediatR
  • FluentValidation
  • Swagger
  • StyleCop

System Architecture

The solution utilizes an onion styled architecture and consists of multiple layers, where each layer depends only on itself and the layers that are below it in the hierarchy.

Domain

The domain layer contains all of the entities, value objects, enums, interfaces and logic that is specific to the domain. It does not depend on any other layer in the system.

Application

The application layer is responsible for orchestrating all of the application logic and the necessary use-cases. It depends on the domain layer, but has no dependencies on any other layer. This layer defines additional interfaces that are required for supporting the application logic, that are implemented by outside layers. For example, the IDbContext interface is defined in this layer but implemented by the Persistence layer.

This layer utilizes the CQRS pattern for structuring the application logic into commands and queries, using the MediatR library.

Infrastucture

The infrastructure layer contains classes tasked with accessing external resources. These classes are based on the interfaces defined within the application layer. In the current system, this layer is possibly oversimplified and redundant as it contains only the MachineDateTime class for getting the current UTC date and time.

Persistence

The persistence layer is responsible for implementing database related concerns. It contains EF Core Configurations for entities, implements the application database context and wires up some persistence related dependencies.

Api

The Api layer represents the last layer in the onion, and is responsible for glueing the entire system together. The only function of this layer is to accept HTTP requests, package them up into commands or queries, and send them somewhere else in the system to be processed and then return the result of that processing in the response. The controllers are designed to be as thin as possible.

Race simulation

The race simulation is implemented using the BackgroundService class, which makes it easy to register a long running background task. The background task starts running as soon as the application starts up, it runs an endless loop searching for a race that is in the running state and then processes all of the vehicles of that race - basically simulating the passing of one hour during the race. After each loop iteration, the task is dormant for a certain amount of time that is controlled through the application settings. The race is moved to the completed state once all of the participating vehicles have either been broke or have completed the race.

Swagger UI

The Api project will open up the Swagger UI once it starts. Here you can browse the documentation for each endpoint, making it easy to test all of the endpoints.

Swagger UI

rally-simulator's People

Contributors

m-jovanovic avatar emirhanaksoy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.