Help with API structure
I want to create modular API structure https://timdeschryver.dev/blog/maybe-its-time-to-rethink-our-project-structure-with-dot-net-6#a-domain-driven-api like in this article. I split solution into .API and .Modules project. The problem is that I'm using MVC in my project and I don't how to apply it for MVC. For example where should I create controllers? In API project or Modules project?
Maybe it's time to rethink our project structure with .NET 6
Challenging the status quo with some thoughts on the new .NET Minimal Web API to keep code simple
23 Replies
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
in the article it's used to inherit from so that each module has RegisterModule method
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
no I'll have 5-10 modules at max
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
That means I just need to create static class Module1.cs that will have extension for IServiceCollection contains method AddModule1() where I register all dependencies?.
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
yes, but I use Controllers instead of Minimal API and I don't have endpoints like in the example
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
yes, I understand, but I don't know what project I should create Controller.cs, in the .Modules ClassLibrary project or ASP.NET .API project
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
Isn't it how application in .NET are created?
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
I watched people create solutions in .NET and they split them into separate projects. .API, .Database, .Core and etc
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
I’m currently doing projects so that I can be hired as an intern at some company and I want to show that I can structure code, etc. I thought it's a good idea to split it
for starters I can do it as one project, shouldn't have overthink it
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
that's a good advice, thank you. I got a lot of difficulties because I split my solution into separate projects and sometimes it happens that I needed "circular" reference between them and I had to create one more project and move classes there and reference it, which would be much easier if it wasn't split
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
But the application wasn't that big and I had a separate project with 1-2 classes in it
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
No I won't do the "repository" because I'll use EF. Last time I did it and it was over engineering as it completely resembled "service". I'll keep it simple this time
TeBeCo
Embed Type
Video
Quoted by
<@689473681302224947> from #advanced (click here)
React with ❌ to remove this embed.