C
C#7mo 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
Pobiega7mo ago
Are you just trying to learn how to do dependency injection in modern .NET?
SG97
SG977mo ago
runs just fine? maybe be a bit more specific on what you want it to do
Tekimoto
TekimotoOP7mo 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
Pobiega7mo ago
uh... whats the point in running a super simple example of a DI setup for a nonprogrammer? 😄
Tekimoto
TekimotoOP7mo 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
SpReeD7mo 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
Pobiega7mo ago
as SG said thou, it runs just fine
Tekimoto
TekimotoOP7mo 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
SpReeD7mo ago
It'll compile, but you cannot run it, it's just an example.
Tekimoto
TekimotoOP7mo ago
how can i do that also is it on .NET6 ?
Tekimoto
TekimotoOP7mo 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
SpReeD7mo 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
TekimotoOP7mo ago
So what is the meaning of the asigment it says
Tekimoto
TekimotoOP7mo 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
TekimotoOP7mo 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
SpReeD7mo 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
TekimotoOP7mo 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
SpReeD7mo 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
TekimotoOP7mo 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
SpReeD7mo ago
Do you need to learn from that specific source? I would advise you to search for another tutorial.
Tekimoto
TekimotoOP7mo 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
SpReeD7mo 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
TekimotoOP7mo 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
SpReeD7mo 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
TekimotoOP7mo 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
SpReeD7mo 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
TekimotoOP7mo 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
SpReeD7mo ago
here
Tekimoto
TekimotoOP7mo 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
SpReeD7mo 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
TekimotoOP7mo 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
SpReeD7mo ago
Do a build.
Tekimoto
TekimotoOP7mo ago
in OrderManagementConsole.csproj
Tekimoto
TekimotoOP7mo ago
No description
Tekimoto
TekimotoOP7mo ago
Even though i change 3.1 to 6.0 i can see that here it still mentions 3.1.1
SpReeD
SpReeD7mo ago
build is kind of a synonym for compile in VS. Go to Build->Build Solution
Tekimoto
TekimotoOP7mo ago
do i have to change that 3.1.1 to 6.0 first?
SpReeD
SpReeD7mo ago
Na, leave it, if it compiles, this is another assembly/dll/library.
Tekimoto
TekimotoOP7mo ago
do i open the sln file first? in visual studio
SpReeD
SpReeD7mo ago
yay
Tekimoto
TekimotoOP7mo ago
which of the 2? OrderManagementConsole.sln or OrderManagement.sln ?
SpReeD
SpReeD7mo ago
Both, seperatly, you gotta do it twice.
Tekimoto
TekimotoOP7mo ago
ok lets start with OrderManagement.sln i did it build solution
SpReeD
SpReeD7mo ago
You should see an output like 1 succeeded in the Output window
Tekimoto
TekimotoOP7mo ago
No description
Tekimoto
TekimotoOP7mo ago
nothing its empty
SpReeD
SpReeD7mo ago
Also in your folders, there should be a bin folder, this is where the compiled binaries are stored.
Tekimoto
TekimotoOP7mo ago
i see the bin yeah and it says net 6.0
SpReeD
SpReeD7mo 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
TekimotoOP7mo ago
so now i did build both in both bin folders i see an exe must i run it?
SpReeD
SpReeD7mo ago
No
Tekimoto
TekimotoOP7mo 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
TekimotoOP7mo ago
from these files
No description
Tekimoto
TekimotoOP7mo ago
@SpReeD ?
SpReeD
SpReeD7mo ago
Well, that's what you got ¯\_(ツ)_/¯ Don't ask me for approval ^^
Tekimoto
TekimotoOP7mo ago
i am asking for opinion do I need to give the bin folder alone? or everything?
SpReeD
SpReeD7mo 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
TekimotoOP7mo ago
should the exe be working?
SpReeD
SpReeD7mo ago
It means it compiles, but no, it's not working, again, it's just an example code.
Tekimoto
TekimotoOP7mo 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