C
C#2mo ago
Tekimoto

dependency-injection-dotnet-core

Hello. I know that this is an old example but it is very important to me to run this code (If you want to know why I will personally answer in DM). Anyway this is the example. https://github.com/auth0-blog/dependency-injection-dotnet-core It mentions that the code is not meant to run, but just to support the article https://auth0.com/blog/dependency-injection-in-dotnet-core/
61 Replies
Pobiega
Pobiega2mo ago
Are you just trying to learn how to do dependency injection in modern .NET?
SG97
SG972mo ago
runs just fine? maybe be a bit more specific on what you want it to do
Tekimoto
Tekimoto2mo ago
I am not a programmer. I is an asigment for another class that just says this: It specificly asks this: DI exercise for web and console based on the example in .NET6 Run DI for web and console based on the example https://auth0.com/blog/dependency-injection-in-dotnet-core/
Pobiega
Pobiega2mo ago
uh... whats the point in running a super simple example of a DI setup for a nonprogrammer? 😄
Tekimoto
Tekimoto2mo ago
Its assigment for a class that they forced me to take thats it is about this. only class left to finish my studies or they delete me
SpReeD
SpReeD2mo ago
Tbh I find the lesson over complicated and DI isn't even correctly implemented where it actually should be.
private static readonly HttpClient httpClient = new HttpClient();
private static readonly HttpClient httpClient = new HttpClient();
Is straight crap in a lesson about DI.
Pobiega
Pobiega2mo ago
as SG said thou, it runs just fine
Tekimoto
Tekimoto2mo ago
i have 0 knowledge, how do I run it? Did you download it?Does it run for both Console and Web ffolder Also how do you run it ?
SpReeD
SpReeD2mo ago
It'll compile, but you cannot run it, it's just an example.
Tekimoto
Tekimoto2mo ago
how can i do that also is it on .NET6 ?
Tekimoto
Tekimoto2mo ago
My asigment says to do it on net 6 but it gives me this example https://auth0.com/blog/dependency-injection-in-dotnet-core
SpReeD
SpReeD2mo ago
Change the Targetframework to net6.0 and you're fine, no big deal then. You need a compiler to compile sourcecode into binaries. Easiest way to get along is to install Visual Studio which is an IDE and comes with a compiler, framework supports and all the other fancy dandy stuff. The *.sln files are so called Solution, they include the Projects, open one up with Visual Studio, go to Build->Build Solution and it'll compile. But again, you cannot run the code, it's just and example, the endpoint isn't existing.
Tekimoto
Tekimoto2mo ago
So what is the meaning of the asigment it says
Tekimoto
Tekimoto2mo ago
DI exercise for web and console based on the example in .NET6 Run DI for web and console based on the example https://auth0.com/blog/dependency-injection-in-dotnet-core/
Auth0 - Blog
Understanding Dependency Injection in .NET Core
Learn what Dependency Injection and IoC are and what .NET Core provides you to support them.
Tekimoto
Tekimoto2mo ago
do i have to make the code run some way? thats all the asigment asks nothing else and of course they do not answer any question as always..
SpReeD
SpReeD2mo ago
The meaning is, just a wild guess here, to teach you about Dependency Injection, which is definitely not the first thing you teach somebody who never wrote a single line of code ...
Tekimoto
Tekimoto2mo ago
Trust me I know they forced me to take this subject for somee reason my field is not a programmer but it is nessesary to do this or they will delete me so I have 0 knowledge on this So I will have to risk it and give them the final code from here but I will first have to change it to net core 6 I know you told me how to do it but can you explain to me a little bit more how I can change it? first of all I have to download it somehow
SpReeD
SpReeD2mo ago
Replace
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
with
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
in both csproj project files. Click on Code, the green button, and then Download ZIP, easiest way if you don't have GIT installed.
Tekimoto
Tekimoto2mo ago
you know, doing that keeps the dates on the files as 2020 someone told me that i can get it somehow with a rep method from visual studio so the files dates are today so it is not that obvious that i copied it and it would seem more like i followed the tutorial
SpReeD
SpReeD2mo ago
Do you need to learn from that specific source? I would advise you to search for another tutorial.
Tekimoto
Tekimoto2mo ago
not at all all I need it to give this DI exercise for web and console based on the example in .NET6 Run DI for web and console based on the example and if that is whay they want i am done i am not a programmer its just a stupid subject they forced on me because the other subjects were full and also its the last subject after that I get my degree but it is due tomorrow if i dont give it the proffesor told me that i will be deleted he is really awfull and i am really anxious
SpReeD
SpReeD2mo ago
Technically you are, since you're programming almost everyday; programming the alarm on your clock. The right term for people who write code is developer. And it's not a stupid subject, it's super exciting 😄
Tekimoto
Tekimoto2mo ago
yeah i believe so for people of the subject but it was forced on me and the proffesor really threatens me I am prety sure I know the reason I just really need to get this done and move on You seem really kind thank you for putting in time
SpReeD
SpReeD2mo ago
I have no clue about it, but... follow this guy here, he explains DI in a very good way, imho, not overcomplicated, sticks to the basic and explains all the code. https://www.youtube.com/watch?v=cCSrPZroICg
Skill Foundry
YouTube
Dependency Injection in C# ❘ A Hands-On Guide to Boosting Code Flex...
Welcome back to Skill Foundry! Today, our expert Eric Wise will demystify Dependency Injection, a must-know for any coder aiming for better code flexibility and testability. We'll kick off with an overview before diving into hands-on coding, using C# to transform a basic Rock-Paper-Scissors game through Dependency Injection. This tutorial is use...
Tekimoto
Tekimoto2mo ago
i really dont know the basics of programming it is imposible to follow for me can you help me downlaod this change it to net 6 and compile it? https://github.com/auth0-blog/dependency-injection-dotnet-core
SpReeD
SpReeD2mo ago
I believe you, but other than that, I cannot help you. Can't write code for you, especially if you don't know what's in there.
Tekimoto
Tekimoto2mo ago
dont write code its there just help me understand how I can download it change it to net 5 net 6 and move on with my life
SpReeD
SpReeD2mo ago
here
Tekimoto
Tekimoto2mo ago
git clone -b starting-point --single-branch https://github.com/auth0-blog/dependency-injection-dotnet-core.git i tried this but it downloads only OrderManagementWeb folder and not OrderManagementConsole
SpReeD
SpReeD2mo ago
Because there are two branches in the repo, by -b starting-point you select a different branch that goes by the name starting-point, it only includes that one folder. Just do it simple, use git clone https://github.com/auth0-blog/dependency-injection-dotnet-core.git
Tekimoto
Tekimoto2mo ago
in visual studio? perfect it worked now about change it to net 6 i changed netcoreapp3.1 to net6.0 in both csproj files is that enough?
SpReeD
SpReeD2mo ago
Do a build.
Tekimoto
Tekimoto2mo ago
in OrderManagementConsole.csproj
Tekimoto
Tekimoto2mo ago
No description
Tekimoto
Tekimoto2mo ago
Even though i change 3.1 to 6.0 i can see that here it still mentions 3.1.1
SpReeD
SpReeD2mo ago
build is kind of a synonym for compile in VS. Go to Build->Build Solution
Tekimoto
Tekimoto2mo ago
do i have to change that 3.1.1 to 6.0 first?
SpReeD
SpReeD2mo ago
Na, leave it, if it compiles, this is another assembly/dll/library.
Tekimoto
Tekimoto2mo ago
do i open the sln file first? in visual studio
SpReeD
SpReeD2mo ago
yay
Tekimoto
Tekimoto2mo ago
which of the 2? OrderManagementConsole.sln or OrderManagement.sln ?
SpReeD
SpReeD2mo ago
Both, seperatly, you gotta do it twice.
Tekimoto
Tekimoto2mo ago
ok lets start with OrderManagement.sln i did it build solution
SpReeD
SpReeD2mo ago
You should see an output like 1 succeeded in the Output window
Tekimoto
Tekimoto2mo ago
No description
Tekimoto
Tekimoto2mo ago
nothing its empty
SpReeD
SpReeD2mo ago
Also in your folders, there should be a bin folder, this is where the compiled binaries are stored.
Tekimoto
Tekimoto2mo ago
i see the bin yeah and it says net 6.0
SpReeD
SpReeD2mo ago
and there should be a *.dll, this is your binary you compiled out of the sourcecode. the final product, if you want so. So, now you have the binaries, it's net6.0 and the sourcecode. That's pretty much it. And if you have faith, well, pray. - Don't do your assignments last minute^^
Tekimoto
Tekimoto2mo ago
so now i did build both in both bin folders i see an exe must i run it?
SpReeD
SpReeD2mo ago
No
Tekimoto
Tekimoto2mo ago
All the assigment says is this: DI exercise for web and console based on the example in .NET6 Run DI for web and console based on the example https://auth0.com/blog/dependency-injection-in-dotnet-core/ so what must i zip and submit?
Tekimoto
Tekimoto2mo ago
from these files
No description
Tekimoto
Tekimoto2mo ago
@SpReeD ?
SpReeD
SpReeD2mo ago
Well, that's what you got ¯\_(ツ)_/¯ Don't ask me for approval ^^
Tekimoto
Tekimoto2mo ago
i am asking for opinion do I need to give the bin folder alone? or everything?
SpReeD
SpReeD2mo ago
I can't help you with that, dunno what your professor actually wants; like an essay about the topic to sourcecode or some diagrams, etc.
Tekimoto
Tekimoto2mo ago
should the exe be working?
SpReeD
SpReeD2mo ago
It means it compiles, but no, it's not working, again, it's just an example code.
Tekimoto
Tekimoto2mo ago
Something else Do i need the .gitignore file? what is it Spreed can i ask you something?
Want results from more Discord servers?
Add your server
More Posts
Avalonia: how to get the data of a control where the sender belongs to?My program requires a drag-and-drop. when i move a 'part' rectangle into another 'raw material' rectHow do I do an inner GroupJoin on dotnet?I'm using .NET 6 with Entity Framework. This is my situation: I have a BenefitEntity (with Name and On deserializing using Newtonsoft, I get default constructor required issue on mac but not on windowI am trying to use the ChatGPT nuget package `<PackageReference Include="OpenAI" Version="1.11.0" />Microsoft Identity and web apiI need help with integrating microsoft account oauth into my api. I wanna bind it with account on myCSharp dotnet v4.5 unable to compileHey, i am using a legacy program and there's a issue with it, the target version for it is v4.5 and C# Array and Bubble Sorthello i'm learning arrays and bubble sort. My program does not display anything in the console afterDecrease all of arrays by 1, optimization because of Time limit ExeededHi I want a code to reduce all ints in int[] happiness, exept for zeros to stay. I was wondering if ✅ Difference between explicit and implicit operatorsHello there. What's the difference between defining an implicit and explicit operator? I would likresource dictionary confusionSo this is a really weird question, so bear with me as I'm gonna try explaining. I am building a WPFWhat is the equivalent of this react component if made using C# and Blazor?I'm used to just doing .NET + React, but since they improved Blazor so much with .net 8 I'm having s