Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C# TicketHub server implementation #75

Merged
merged 1 commit into from
May 1, 2024
Merged

C# TicketHub server implementation #75

merged 1 commit into from
May 1, 2024

Conversation

philipaconrad
Copy link
Member

@philipaconrad philipaconrad commented Apr 25, 2024

What's changed?

This PR contains a C# TicketHub server implementation (in ASP.NET Core, specifically), along with the necessary infrastructure to get it up and running.

How to test the server

Local, with Docker

If you're using the top-level docker-compose.yaml, try the somewhat verbose/ugly invocation:

VARIANT=csharp docker compose --profile csharp build && VARIANT=csharp docker compose --profile csharp --profile tools up

This will build the docker image for the C# TicketHub server, and then launch the top-level docker-compose under the csharp profile (selecting "always on" and "csharp"-specific services).

You can shut down the pile of services with the following invocation:

VARIANT=csharp docker compose --profile csharp --profile tools down

Local, with .NET Core tools

In the server/csharp directory, run make run, and then fire requests at the appropriate localhost URL.

Github, via GH Actions

See the PR checks on this Pull Request. 😉

Notes

  • The Entity Framework Core models were derived by starting up the database-node service, and then running the horrifying invocation:

    dotnet ef dbcontext scaffold "Host=172.20.0.4;Database=postgres;Username=postgres;Password=schmickethub" Npgsql.EntityFrameworkCore.PostgreSQL --project TicketHub/TicketHub.csproj`
    
    • Modifications were required afterwards in PostgresContext.cs to get the Navigation Properties set correctly on the Ticket model to work right were required.
  • Because our cookie values involve spaces, we have to parse the raw header values ourselves. (See the Relevant StackOverflow thread for details)

  • Because the DB schema uses timestamps without timezones, we have to save local time values to the DB instead of UTC. 🤷

@philipaconrad philipaconrad added the enhancement New feature or request label Apr 25, 2024
@philipaconrad philipaconrad self-assigned this Apr 25, 2024
@philipaconrad philipaconrad force-pushed the csharp-server branch 3 times, most recently from 24fa91b to 3a225ea Compare April 30, 2024 21:46
@philipaconrad philipaconrad marked this pull request as ready for review April 30, 2024 21:46
@philipaconrad philipaconrad changed the title WIP: C# TicketHub Server implementation C# TicketHub server implementation Apr 30, 2024
@philipaconrad philipaconrad added the c# Pull requests that update C# code label Apr 30, 2024
This commit provides an ASP.NET implementation of the TicketHub server,
using the Npgsql, NodaTime, and EF Core Framework, and Styra.Opa
libraries.

Signed-off-by: Philip Conrad <[email protected]>
Copy link
Contributor

@charlesdaniels charlesdaniels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work on my machine with VARIANT=csharp docker compose --profile csharp --profile tools --profile react up

@philipaconrad philipaconrad merged commit 994a8c7 into main May 1, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c# Pull requests that update C# code enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants