Dynamically load API Controllers ASP.NET
So i was thinking of a concept that allows me to seperate my controllers from the main application in ASP.NET
The way it would work is that i can make some sort of DLL/Library file for specific controllers and put them into a folder along with the main program which then load as controller
for example
Main App
-> APIController.dll : contains /api/
-> ServiceController.dll : contains /service/
and so on
TLDR;
How to make APIControllers load dynamically as DLL files if possible
41 Replies
a bunch of people asked for this recently
https://learn.microsoft.com/en-us/dotnet/api/system.reflection.assembly.loadfrom?view=net-8.0
it's something i wanted to try too, honestly
Assembly.LoadFrom Method (System.Reflection)
Loads an assembly.
Kowalski
<@347434717022257162> Okay i figured it out. Apparently if i wanna use controllers from a different assembly, i need to add them as "ApplicationParts" like this
Quoted by
<@347434717022257162> from #How to integrate ASP .NET project in a WPF app? (click here)
React with ❌ to remove this embed.
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
I mostly want to do it for the sake of being able to update more flexibly
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
https://www.youtube.com/watch?v=T-EwN9UqRwE
https://codeopinion.com/restructuring-to-a-vertical-slice-architecture/
dotnet
YouTube
Vertical Slice Architecture: How Does it Compare to Clean Architect...
Is Vertical Slice Architecture the next big thing or just as cool new kid?
Enterprise software development requires you to choose the right architecture. This session with Luke Parker will provide a realistic dive into Vertical Slice Architecture (VSA) with .NET; showcasing the potential shift from Clean Architecture (CA) to VSA.
You will lear...
Derek Comartin
CodeOpinion
Restructuring to a Vertical Slice Architecture
What is Vertical Slice Architecture? It's about focusing and organizing code by features and capabilities, not technical concerns!
Imagine if I want to add a new feature and suddenly need to make an urgent patch
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
Hm
Would still be nice for a multi service backend
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
Pretty much
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
I mean reverse proxy and all is fine I did that before I just think if I want to add more stuff I'd rather have it dynamic
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
Hm
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
Talking about git
I use a method called feature branching so every new feature gets a branch that gets merged into dev branch and then eventually into release branch
If something is merged into dev branch my feature branch won't be updated cause it's not dev and then I need to rebase
Since I couldn't test it yet, will rebasing my code to dev branch delete my new feature code?
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
Once.
But I just changed 1 line in a readme
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
I mean no
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
But I'm not sure what happens to files that have been updated in the previous merge
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
I see
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
Thing is that I only ever used git as a solo developer and I only had my dev and release branch so far
But I'm slowly starting to develop in smaller teams and figured feature branching might be a good approach
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
Ah
Yes
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
the only tool that will avoid difficult commit conflicts is organizing the work beforehand
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
Yes yes
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
A rebase is done typically before beginning the work
This way it's always up to date
if you have setup a webhook that notices you when other people commits it's good
if not you just try to fetch before a commit
Anyways I'll try to figure out a way for my original message later and also take a look at feature slicing
We do
I never do anything without those webhooks they are wonderful
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
Yes
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
I mean this