❔ Understanding project structure - Visual Studio ASP.NET Core
I was assigned a task, to split a big Web Service into smaller independent Web Services.
The thing is, I only have the past 3 days of experience with working with C# and Web Services.
That being said, I'm slowing learning my way into them, and now I would like to analyse the original project I have to split.
The image is a snippet of the solution explorer.
Could someone help me understand what each icon means?
They all contain a bunch of stuff and files inside, so I'm not really sure if the icons are related to the contents, but I have to start somewhere. :)
2025 Replies
Here is the solution explorer expanded one level, maybe it might help to see a the contents.
helper
and proxy
are web projects (the globe symbol)
UnitTestProject
is a unit test project (contains your unit tests, aka automated code tests)
the rest are class librariesSo in the
web
solution, helper
and proxy
are two separate projects?Everything in the top image except
web
and Solution items
are projects.
not all projects are runnable on their own. You have two that are (helper, proxy).Thanks 😅
So yeah,
helper
is a web project (just like your new one)
its an older one thou, so its not written in the "minimal api" style, but rather using controllersThe
proxy
one is apparently obsolete, and no one really know what it's doing, it was made by some person that is no longer in the group
So I''l leave that aside from nowSure.
The biggest question I have currently is
What are the
Program.cs
and especially the Startup.cs
files
Since the code in the Program.cs
does not reflect the code that the tutorial taught melike I said, this is an older project structure
and most likely also using older .NET Framework
while your new project uses the much more modern .NET
I see. So what weirds me out is that, no route is done here
All the routing is done is the Controllers
yes.
Thats how controllers work.
Well
If you look in
Startup.cs
thats where you see most of the configuration
including the line that maps the controllers 🙂maybe by this method
the program/startup split is an older pattern that has been merged into a single file in the new ASP.NET versions
yup, that method "replaces" your
builder.Services...
stuff in your new oneI see...
This might be a silly question
but does Dao mean anything special to you?
Data Access Object?
Yep
I never really understood that
Isnt that the point of a Controller
¯\_(ツ)_/¯
Its a pretty generic term
It may or may not be the same thing as a DTO (Data Transfer Object)
I see
Looking at code that apparently is very outdated and having to separate everything is weird
I never know if I should copy paste everything or re write it to modern code
A rewrite might take a very long time.
you said it was several thousand LOC per library
Going back to the structure, inside the
helper
project, what would the Services
folder contain?thats not trivial to rewrite, especially not when you are new to C#
yep I agree
Services
is one of those words that dont really have a meaning
its most likely just a bunch of classes that contain logicSo there are 2 weird folders,
Logs
and wwwroot
. They have like a ghost-folder icon thing
Does that mean anything?means they are empty but force-included in the project
or hidden, might be that too
you can open the .csproj and see
but
Logs
is likely a placeholder folder to store logs created during execution
logging.AddFile("Logs/helperApi-{Date}.txt");
wwwroot is a special name
Ah yes
its the "root asset folder"
for a webprogram
its where your static stuff goes, I'd wager
but since this project doesnt have any... its empty
Well, we dont reply Razor pages
I have not done .NET framework development since 2016, so its a bit rusty
It's fine, hey you know much more then me thats for sure
So they told me here to do something
They told me to set up a VM
running windows
(they want to use kubernets in windows)
oh btw, i talked again with the boss and he told me (regarding IIS and Kubernetes) that IIS would not be managed by Kubernetes
there would be the IIS and the kubernetes would run bellow it, i think he just forwards tragic to the services? idk
would have to read more about it when the time comes
Anyways, set up a VM running windwos
and to run the Service as is, in it
and then to try and idk delete certain parts and see what happens
If I installed visual studio in the VM, that would be cheating right?
I think the hole point is to have a machine without dependencies
If I install vs then... I would have everything there?
Actually
Would I be able to put the service in a container since the code is kind of old?
So many questions going trhu my head.... I need to step back a bit i think
Thanks for the patience so far.
This makes no sense. IIS would then effectively be a single point of entry, kind of like an API Gateway... but much slower than an actual API Gateway.
and how would it "contact your kubernetes", the entire plan there was to run the gateway and the load balancers in the cluster so they can handle all that invisibly
you CAN remove the gateway, but you will need a load balancer for each service INSIDE the cluster
or you will not get any auto scaling
running .net framework on windows in a container? I have never done this. I've never worked with windows containers at all.
ISnt the ASP.NET Core cross platform? Should be fine I think
the closest thing Ive done is run Docker for Windows in WSL mode (running on the windows subsystem for linux)
Core is. Your old stuff is NOT using core.
thats on good ol' windows only specific .NET Framework
How can you tell? Just so I know how to show to the people above me
So I would have to rewrite the whole thing?
panic installs
I can tell by looking at the structure of the project. You can tell by looking at the .csproj files
This is bad, isn't it
Arent we like on the 7.0 version
It's.. actually not. It's not the latest, but it's a lot better than framework 4
Wait, 3 is better then 4?
Dont the numbers go up?
framework is old.
Look up .net version history
It's framework 1 - 4, core 1 - 3, then .net 5 to 7
That's specifically framework you are watching
Anyways, got a meeting, bbl
I see...
good luck and thanks for the help so far :)
So, a few questions regarding the target framework
When you say this, is there something I can do?
Would I have to rewrite the hole code, or would just making a .net core project and pasting existing code solve this issue?
Well, it looks like it actually is using core, just an old version. You could try updating it to .net 6/7
Yeah, I was looking thru the .csproj and some stuff says Core in them
This is kind of confusing honestly
Evrything is so similar
From what I saw, only .NET Core 7.0 is cross-platform
So it is using Core
just not the most updated version
Can it really be this easy?
Well, a bunch of errors
But
It runs regardless?
Unlikely. There will be breaking changes
He didnt update the .csproj files hmmmm
A lot of things he fails to find with the .NET 7.0
You need to update all the projects, except maybe the libraries (if they are .net standard)
Are all versions of .NET Core cross-platform?
So first, lets clear up a confusion
.NET Core is version 1, 2 and 3.
Yes please 😅 I have many
.NET 5 6 and 7 are NOT called "Core"
they are just .NET 5 6 and 7
ASP.NET Core however decided to keep the "Core" suffix... so thats version 1 to 7
All versions of .NET Core (1-3) and .NET (5-7) are cross platform
Okay, that makes more sense
I mean, the explanation
Not the names they used Xd
Yeah, the names are insane.
So speaking in terms of containerizing things
Because that is a big factor here
Would the version I choose, besides the framework ones, be a issue?
Since they are all cross-platform
Right. Yea you should be able to containerize these, both as .NET Core 3 and post-upgrade (if you do that)
Okay okay, that is good, no need to diferentiate from windows containers or linux containers, correct?
I have never worked with windows containers. I do not know how they work.
but I would need to use windwos cointaners?
No. You would not.
isnt the point of cross'platform to run on every platform?
Ah
Yes, but you dont need to run a program in a container
you can run it outside a container on linux, mac or windows
you can run it just fine inside a linux container, on a windows, mac or linux OS
Well yes, but since the end goal is to have kubernetes orquestrate the applications, i have to containerize them
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I ask alot of things
Sure. But remember that kubernetes doesnt run windows.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So if you want to run this on k8s, you need to make sure it builds and runs fine on linux, and it likely will
What? Kuberenetes runs on windwos
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
^
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Iºm not trying to doubt what you are saying is just that I read things online and them people tell me otherwise and them my boss tells me otherwise and I just keep going back and forth
Dont host anything on windows, ever, if avoidable...
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
its bad enough that you need to run a "gateway" on IIS already
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
he told me that, regarding IIS, they have more experience with it and want to keep it, and regarding Windwos, people here are more used to work with Windwos, but if I make a good argument he told me heºd consider
lol
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
But what are the big issues?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Because in Kubernetes website they say they can run on Windows, and that is what my boss sees
k8s on windwos
your boss is an idiot.
Period.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Well I still had to do what he tells me, I just have to convince him to change by making good arguments
i'd be the maintainer of the windows cluster, if I got it implemented
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Okay, you will get way worse performance, way more node load, a MUCH harder time to find an ops team who can manage the cluster...
I have not even learned how to use kuebernetes
running your own cluster isnt trivial
This exactly. Much lighter weight containers, lower cost, can spin up more at a time, speed, security...the list goes on
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
nope
He told me to learn kubernetes
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
🤣
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Im dying here
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
that is a great question
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
cloud I think
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
fair
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
or just lambdas, since the entire reason behind wanting this in k8s is auto scaling
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
and to be frank here, @dryfish you seem to be quite new to this whole thing. Learning how to USE a k8s cluster is quite the undertaking... learning how to CREATE and MANAGE a cluster on your own is... a whole different story. This would be a big task for a senior devops engineer.
and if your company has subscriptions for it, I would definitely recommend looking into some Pluralsight videos to learn how to use/manage clusters
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Okay
I went and talked with him
I asking him about the cloud
he is not using Azure nor Amazon
nor Google
He is using a cloud from our country network provider
Now I have no cluie why that has anything to do with Kubernetes
honestly reading all that I dont really know what to think anymore 😅
Im a junior developer
I'm about to complete 3 months here, this is my first job
So i'm learning things, everything is very new to me
I dont believe in a impossible task
However everywhere I look it makes it seem like this is impossible Xd
This is all new to the boss too
They didnt really give me a deadline
Since it's a lot to do
So maybe if I take things slowly
I'll talking with him about using linux and not windows
but could you please expand a bit more on what role the cloud provider has to do with Kuberenetes?
I though Kubernetes is just something I ran on the computer, that managed containers
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Kubernetes isnt a "program" as such.. its a group of computers (individually called nodes) connected in whats called a cluster.
You talk to the master node and tell it that you want 3 instances of some container to be ran. The cluster then runs that on the nodes, according to your specifications.
HUGE simplification here, obviously, but thats the gist
the cluster takes care of restarting a pod (an instance of a container) that crashes, or if a node crashes etc
there are then smart programs that interact with the cluster they are running in, like auto scaling load balancers
they will run as a pod on a node, but automatically request more pods as needed if they are seeing high load
Running your own cluster is hard, and since you have a local cloud provider, they likely offer "kubernetes as a service" already
(my company runs on a similar solution)
so we have a private cluster in a private cloud, and they have an entire team of ops/SREs who help manage it, and help us with stuff like k8s upgrades
Me too. I meant that I'm working here for 2 months and this month will make it 3. I was referring to the amount of time spend in the company
Altice
So a Cluster os a group of computers, each called a node, and inside the cluster there is a master node?
So, if the cloud provider does not support a Kubernetes cluster, I'm... basically fucked?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
he is a dev and software arquitect
yes.
specifically, each node in a cluster is a computer that runs an "agent" program that makes it part of the cluster.
you can ask a cluster what nodes are currently available etc
and it would be 1 + the numebr of computers?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
1 being the master node
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
well sure, but computers start and stop.. including the master node
so you usually have multiple masters
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I need to have a computer whos only job is to be the master node?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
if you operate your own cluster, yes
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
but you really DONT want to operate your own cluster, if you can avoid it
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So lets say the cloud provider supplied the cluster, I would just need to creat the machines inside, and tell which is which?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
you dont worry about nodes/masters etc at all, you just worry about deployments and pods
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
you pay for X nodes, usually
It would do the autoscaling for me?
like "I want a cluster with 6 nodes of this size"
you can configure autoscaling in multiple ways
since this is a HTTP service you want to scale, a load balancer would be a good idea
it can keep track of number of requests that are ongoing and how long they are taking etc
So just so I can put things in prespective, lets say using kubernetes from scratch is 100% work, how much work would get off my shoulders if the cloud provided handled the cluster?
because I'm not sure neither is my boss, that the cloud provider has kubernetes support
assuming your service is already written, tested and works? somewhere around 5-10% maybe
Only?!!
as in, 90% of the work is gone
you have 10% remaining
OH
okay
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I was scared for a sec
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
👀
don't worry, its a beautiful thing shared between 2 consenting adults...
kubernetes management, that is
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Okay so I definitly need to communicate this with my bosss then
I will try and see if I can get a link to it, the thing is
its not a public thing iirc
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
https://www.altice-empresas.pt/solucoes/cloud-datacenter/cloud/servidores-privados
It is
btw this website is not english
because this is my country provider
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
XD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Well
they say they have a hybrid azure thingy
and they wrote Kubernetes in a list
so
maybe Kuberenetes
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
This day keeps getting better and better
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I think we need to talk to them and see if they have something for Kuberentes
this might be a sily question, but what should I ask for specifically?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
managed kubernetes
If I asked "can you manage a kubernetes cluster for us"
yes
is this a silly thing to ask?
oh ok
no
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
thats a good first question. they either can or they cant.
Is there some sort of documentation that backs up this cluster thing?
Im scared they might ask questions I dont know the anwser to
Is that good or bad? I feel so dumb rn
They might ask how many nodes or what kind of load you expect
WOuld I need N clusters, one for each Service?
no
1 cluster
Or N nodes, one for each service?
not one for each service
you might need way more
depends on load
How will I know how much I need
if you only run one instance of each service, 2 nodes might be enough.
you need to know the average and peak load of your services, more or less
what is the units we are talking about here?
I could ask for that inforamtion
whatever makes sense. execution time per request, number of requests per second
is there high CPU load, or IO load?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah, that will tell them I know my stuff XD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see, lightly touching the subject
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I didnt pick up aggression from the text honestly
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Noted.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
kekw
LMAO
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
THre is another side to this
so the company i work in is the second biggest customer they have
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
and we have a close relation with them apparently
like we have direct access to the people in charge and whatever
I'm afraid that
if they dont support Kubernetes
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
my boss wont look for alternatives
cause he might be too found of them idk
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah xD i did that too
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
so... more dollar?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yes, probably
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
azure stack is expensive
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
this whole conversation just feel like something outside of my area lmao
this might all be getting way ahead of yourself tbh
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
make your services.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yep lol I still have to split the godammn things in the first place...
since you are replacing a single IIS server running all 6 services, you likely dont need that many VMs tbh
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah and if I solve every problem i'll be king of the world, but do I want that?
My goal is to be a teacher, I'm not really a money person.
I'll still learn the things tho, it's just not my mindset, to "grow and earn more", it's just to "grow"
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
btw
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
@Pobiega and I were talking the other day, regarding IIS
I asked my boss and his idea is the following
He wants to use IIS
and for that to be external to Kubernetes
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
now I dont even know how any of that even works
but
does that make sense?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I talked with him about using Kestrel but he has a lot of knowledge on IIS and they work with it for a long time
thats basically it
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
well, it would be eventually
they have a single webservice running on IIS right now
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
its slow. they want to make it faster and split it so it can be scaled individually
this
it currently handles ~6 "subservices"
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
its not
chill
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
so, these 6 subservices are to be made standalone asp.net services
thats where k8s came into the picture, to be able to scale this
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
exactly.
BUT
yeah, and to allow different kinds of deployment
here came the boss and said "I dont trust this Kestrel stuff, I like IIS, I want to use IIS"
"oh and also, I want a single point of entry to all the services"
I had previously suggested using an API gateway inside k8s for this
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
well actually, the cloud provider would handle that
how on earth?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yes
if I understood things correctly, the cloud provider actually sends the requests to the correct routes
So they operate an API gateway
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
He told me not to worry about it, is what im trying to say\
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
there are more then 3 confusions here for sure, atleast on my side
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
The colud provider, assuming it would handle the cluster for us, would also take care of that, correct?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
which I would have to configure?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
it normal to feel like i'm completly lost?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Okay, just making sure
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So that times 6
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
maybe after I figure out how to split the service into smaller ones, I can ask my boss for a team
since that is a lot to maintain
or atleast seems like a lot
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
well atleast its well documented i guess
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
the anoying thing is taht you need to understand wtf u're doing
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
right know most of the stuff mentioned here rings no bells, but i'm slowly kind of getting the overall concepts which is nice
don't worry about k8s right now
get your services up and running
yes that is probablty the best advice
once you have 6 individual working services, then you worry about deployment
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
^
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah I agree, do you recomend someone for this kind of situations? does kubernetes offers some sort of support line for this?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
"to ask about kubernetes, you must know about kubernetes"
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
sad part is that I am
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
He legit just told me this "we will setup a VM for you to run kubernetes in, get it to manage a few containers, and them we will put that online"
I was like "damn okay lets do this"
now im like ".... :( "
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
im not planning on leaving, I jsut started :P Its my first job actually
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
No time limit so far
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
THe service is alreaddy running
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I just have to split it into smaller services
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
the cloud provider hosts the service currently
probably a VM
yes a VM
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yes sir
its an asp.net core 3.1 monolith
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yep, im also a beginner at C# so this is a bit of a challenge too
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I think I will make a call with the previous maintainer
and ask him to help me run the service and show me how to interact
Just... run the service?
its a web service
should be just run and make http requests to it
Well most of the time i dont really knwo what im doing
Can you help me with that?
XD
i sound ridiculous
This is what I know how to do
I know how to use Postman
open visual studio, click run?
to send requests
Just like that?
wont that like
mess with the alreaddy running service?
this question sounds so dumb
no its running on your computer
localhost right?
ok ok
I get it now
i forgot about that
localhost refers to your computer at all times, yes
or well, its technically the loopback network interface... but its close enough 🙂
Okay I actually was messing with the configs and now idk wtf I did but i broke the whole thing
Ill make another clone and delete this one
one sec
i guess this is the embarassing weeks of the junior developer journey
dont know shit, always screwing up
network isnt really my speciallity tho
im a c++, algorithms, low level guy
im just learning about this whole web deal in more detail now
funny thing is im actualy enjoying it
its a fun challenge so far
plus so far the community as been nothing but amayzing, you guys are the living proof
i was honestly not expecting this much help and paciense from anyone really
I have to thank you guys for that, alot
eh, you've been given quite the "junior task"
this is way bigger than what is reasonable
originally I came here to program in Delphi
dodged a bullet there
it was also a language i never eard about
frist 2 months were doing things in Delphi
now they moved me to this project
also new language for me, but way better documentation online
Okay, I have a question
When I open the solution
It alreaddy says IIS here
when I create a new project, it says something like http or something
Why does it say IIS here, what does it mean?
does the solution come with the IIS?
I didnt install anything besides visual studio
I believe IIS Express (not IIS!) is build in and is a way to host your application. I don't have much knowledge on it but it's very different to IIS
You can check your
launchsettings.json
for the various profiles to use. If it's IIS
, IIS Express
, http
, whatever, it will be defined thereIIS Express apparently
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So
Iºm having a weird problem
I run the thing
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I click on the green arrow that say IIS Express
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It starts running
When I try to communnicate with it
I get error 500
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I think so
I asked the previous maintainer what I was doing wrong
He told me to debug
lol
so yeah
not really sure what to do now
is there something I could try?
How do I even debug this thing
😩
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So
the link
he gave me
I asked him about what port was the service using, he didnt know, he sent me a link and the link works? idk
But it gives me 500
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
The target framework of the project is .NET Core 3.0 I think
Does that have anything to do with the problem?
Stack Overflow
HTTP Error 500.31 - Failed to load ASP.NET Core runtime
I'm having issues deploying .NET Core applications to IIS on a Windows 10 machine.
When I deploy to IIS and navigate to the site I recieve the message:
"HTTP Error 500.31 - Failed to load ASP....
What is a
Hosting Bundle
?Why? You can set up IIS on your local pc. You just don't have valid certification.
I used to have it so that my websites could be tested on an actual "valid" host
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
SSL certification
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
change the value of
<TargetFramework></TargetFramework>
in your appsettings.json file to <TargetFramework>net7.0</TargetFramework>
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
"dont need" and "you never want to put IIS on your computer" are two completely different things
Then don't begin with it 😄
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Because I would love to actually understand why you're saying that
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
wont that break things?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It will, you tried it already
Oh yeah right
Well
I tried changing the project
not in the file directly
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
just try it and see, you can always change back to the other version if anything breaks
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
lol, what
it worked?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
What is going on
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
All i did was refresh the browser
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Run In debug configuration
o.O
Not release
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Oke
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Diferent kind of error now
show us
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
What does it say here?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Because you probably have release there
And not debug
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
one second
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
The problem is fixed when you select debug instead of release. No need to select anything other than IIS Express
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Do you have the .NET 7 SDK installed?
he does
I keep forgetting 7 is released
I do? Okay lol
Welp idk
I have no clue man
I installed visual studio
tebeco#0205
share your full csproj
Quoted by
<@!689473681302224947> from #Understanding project structure - Visual Studio ASP.NET Core (click here)
React with ❌ to remove this embed.
we saw that on an earlier screenshot
I'm guessing it's not able to load a .NET 7 feature
.
But idk
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
:(
You're kind of behind on versioning mate
I didnt write any code myself, this is the current service code
This is a core3.1 program
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Just like that? I can just delete things?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
As long as it works, i dont even care anymore
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see...
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
if you wanna update all of these to the latest version you can either use
nuget update YourSolution.sln
or Update-Package
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
just do this instead of looking for each package seperately
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I don't think that will get rid of all these obsolete packages
I got code errors after applying the changes
Ofc you did
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
tebeco#0205
Microsoft.AspNetCore.Buffering
is dead and never ever got releasedQuoted by
<@!689473681302224947> from #Understanding project structure - Visual Studio ASP.NET Core (click here)
React with ❌ to remove this embed.
Looks like a reference to what TeBe mentioned
I dont know, I didnt make the code
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
What was its use?
Before you remove something important lol
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I wanna cry
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So what now....
I can't run this?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It was used here
In the
Startup.cs
fileUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
integrality?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
How would I know how to answer that...
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
there are some hardcoded sus things to share, yes
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
sure
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
God damn it
I think i didnt leak anything
hardcoded connection string 🥹
Imma go on a small break, ill be back in 15 minutes, all this stuff im making me hungry
brb brb
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I'm oh phone, summarize it for me plz 🙂
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Hahaha
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
so, tiny summary about what this app is
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
its an asp.net page that "creates and uses APIs" for webpages that dont have them, that dryfish's team needs to interact with
including stateful sessions
their delphi app sends requests here, the app does some http calls and uses HAP to parse the html and extract the values it needs, then returns a json response to their delphi app
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
kinda, but on demand
ie, it doesnt scrape, it just... uses a non-api webpage to do things
its not just GET stuff
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I've not seen any more code than you have, just talked with dryfish a lot lately :p
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
also, poor dude is a junior dev, brand new to C# and .NET and been handed this .NET Core 3.1 monolith and asked to split it up
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh no sorry
you told me to hide sensitive information
So i did a funny and used facebook there
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
my bad
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ntp04.oal.ul.pt
this is the original linkUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
Hmmm
Not really, just the declaration
atleast that I see
Program.cs
doesnt use that either
so idkUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
Oh wait
the constructor
sets the variable
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I dont know :(
I can do a word search in all files
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
BaseControllers.cs
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
get ready to depress
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
its 300 line of code
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I think so
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
That would be something I should know how to answer
Im going to say no
wait
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
let me first explain to you what people explained to me that this did
Delphi client sends a request to the service
the services gets the html reply of some website, does some parsing and return in JSON format
thats it
in essence
So id say
no Razor buisness
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
remember, this is .netcore3.1
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah we dont have Views here
They called it
BaseController
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
XD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Hey man I also wish they did things right
expesially since everything i find here is differente then the things i find online
and everything is outdated
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
and also i dont understand most things that are here
honestly after all this talk i have no clue how this is running
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
the biggest file i have to split is a 6k lines of code file
its also the most important one
its also the one I undestand zero about
i just wanted it to run
so that I could see how it works by interacting with it
apparently cant even do that
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I removed the oens you marked red
and updated the ones with green
this
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
O
I'll try that
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Its runnig
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It did a bunch of things
runnig just
Update-Package
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It's okay, not a problem!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
that looks good
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I though about that
but
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So
I add file by file?
Eventually reaching full code?
on a fresh .net 7.0 project
okay
Wont that be bad?
To replicate old code on a modern .net
idk
that wont really work, thats not how code works
files refer to other files
So what did TeBeConsulting mean?
create a new .net 7 project and "translate" the code from your startup.cs into the new format, then try and get it running. It will need a few packages.
Ohhhhhh
okay, that seems better
but
i'm going to be honest, I'm going to need help for thtat
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
so
I have a new project
in it I have a
Controllers
folder
you are saying
to move the code that was on the previous project Controllers
folder, into the new project Controllers
folder, correct?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
the jsonserive in the
Services
folder?
(im just trying to understand where te thigns you mentioned are)Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
that sounds alien to me honestly
bad thing about this is
they did not make any documentation about the service
and the original person that made it is gone
so
theres that
time to get your hands dirty
yep XD
open up the file, and get going
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
cloud provider
Okay fresh start here we go
I'm hyped :D
feeling confident
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
of the
JsonService.cs
file, yesUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
xd
is it bad?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Ctrl+Shitf+F time
dear god this is cursed
Its used in a few places i guess
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
thats it pretty much
Its used in some controllers
I think that
Some websites alreaddy reply in JSON format
so maybe its for the ones that dont? or do? I dont know :(
I'm asking the previous maintainer
maybe he has something to say about it
json is THE data interchange format of the internet if you will. Most API will give you json back. XML is still more widely used as of right now iirc but that will change soon
yes, but some of the websites do not reply in JSON and we need to craft a JSON responce after parsing the HTML responce
its for your own responses that your controller endpoint sends when it gets called
probably
but if that was the case, every controller should have a JsonService, no?
only 2 have
out of
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
11
do those other 9 controllers return json too? cuz if not then why should the JsonService be used by them?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
enjoy!
no, because you dont need it to return json
see what it does
what is "it"?
its literally just a
return JsonResult(object)
o
Yes
that service is 100% pointless
it looks like at some point it was only mostly pointless, from the commented out code
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Wait, I dont specify a constructyor
Is this a c# thing?
C# has implicit parameterless constructors
but hes passing it a
object
, whatever that meansno constructor == invisbible default constructor
Im talking about
return new JsonResult(obj);
Its constructing a JsonResult
with a object
but I dont define anny constructor that takes in a object
JsonResult
is not a type from you, its from .net / asp.netOhhh
Lol so yeah this is pointless tf
ugh
lmao the maintainer just replyed "It's useless"
ahahaha
sO whY is It sTilL herE
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
XD
So the positive thing iiiis
I can skip over this file!
One less file to worry about
The next one is
MadExceptParses.cs
but i think I need that one
oh well
actually
its not used anywhere in the project
just in the file where its declared
omg imagine if I went thru the files and in the end only like 10 files actually did something, the rest 40 files where useless
XD
It's used in unittest project
not in the helper one, so I wont need it for this
Okay, this is great, the Services
folder is done...
Maybe I can start with the Controllers now?ehhhm I would suggest the order repositories > services > controllers
because services depend on repositories and controllers depend on services
the services folder is done tho
it had 2 files, one was useless and the other was not behing used
lol i smirked writting this
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Database?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i dont think this is using a database
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i... do?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
entity
framework
core
entity means database
okay
but
I dont make any crud here
no
i just handle requests and parse
entity means, an object that is defined by it's identifier (id)
oh, usually entity means database stuff so i assumed
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
the word entities is commonly used in context of databases but the definition what an entity is is unrelated to databases
I see
So
how can I see the database Im apparently using?
anyway, i dont see any repositories in your solution explorer
so i dont think a db is used in this project
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah i dont think so either
i assume the author just added EFCore dependency without needing it
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
where are you guys even seeing efcore?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Oh okayu
yes there is a reason to use repositories xd you seem to missunderstand the purpose of a repository. A repository abstracts CRUD operations against ANY data source. Whether that data source is an EF Core dbcontext or a file in the local file system is completely irrelevant
Hmmmm
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yep
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Ill ask around
this is not the place or the time, but you are SO FUCKING wrong its not even funny
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
OKay I asked to the previous maintainer
He told me
the DB connection is for logging
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
He told me its loggs exceptions and to check BaseController
@Pobiega do you plan to enlighten me or not? You just call me out for being SO FUCKING wrong and leave it like that? Any place or time
sure, but hehe where is that?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
this is a help thread. you are not helping. But yeah,as tebe said,
DbSet<>
is a repoUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
and the take "there are no repos, thus there must be no database" is one hell of a take
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
See, this is why I said "this is not the time or the place"
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
the EF Core repo debate is so tiring
right and thats the whole point behind Repository Pattern from my understanding... You create an interface that holds methods for CRUD operations. Then one implementation of your
IRepository<T> where T : Entity
might be using a dbcontext<T> as its data source. Another might be using local file system as its data sourceUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
...
you dont get my point
why do you need an abstraction over your abstracted database?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
its fine to use repo over a file system
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
its fine to use it over... whatever. but not EF Core
its already a repo
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
But srsly, take it elsewhere
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Stop it with the EF Repo shit
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
THIS IS A HELP THREAD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
take it to #database and never bring it up again
thank you
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
You're going to cringe
beware
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh I can split
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
its 100 lines of code, its not that big
1 sec
Thats it
@Florian Voß I apologize for the harsh tone, just really tired of the EF Core repo "debate". Sorry.
@Pobiega no worries. Just hoping you're gonna explain it to me... Any place and time you wish
guys, im going home now, (im at workplace)
buuut
ill turn on the computer and reply from there
regardless, thanky uo for the time and patience so far
I'm really glad that you guys are helping me understand all this
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I believe TeBe just did. If that didnt satisfy you, a simple google search should put it better than I can. If that STILL doesnt satisfy you, go ask in #database why repo over EF is not only not needed but a bad idea.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
good morning, I took your advice actually, I got home, turned computer, saw that and was like "he's right"
did some exercise, watched a movie, and took a sleep, now im woke and ready to face c# again
ikr, dont they get that by default?
i see
no, they will be
null
by default, not "empty string"Oh I see
By the way
the connection string isnt really a link
its just a word
Not being a link is expected, but literally just a single word?
well
or something like...
Data Source=.;Initial Catalog=asd;User Id=sa;Password=asd
2 things happen
yes that happens if
var cs = Configuration.GetConnectionString("magicword");
returns nullmagicword is just the connstr identifier for your configuration file
Ohh
and you apparently have a fallback for it
which is weird imho, you shouldnt be able to start a program with a faulty configuration
This is the code flow
then again, this seems to be hacked in, and its "only for logging"
yeah.
Logging exceptions apparently
that second string is your actual connstr that is used when nothing was written in the config file
but that string doesnt really have a link
why would it have a link?
its has a
Server=BlaBlaBla\BlaBlaBla
it has a hostname most likely
yes
the
Data Source
usually in a SqlServer connstrI dont have a Data Source
thats the contact details of your actual sql server
The tags I have are these
ok,
Server
is similar if not the same, it seemsServer=...
Initial Catalog=...
Persist Security Info=...
User ID=...
Password=...
I see
so the value you have there, that is the protocol/hostname/port of your sql server
protocol and port are optional
yeah, no port is specified
you said it was
x\y
?yes
it feels like not sensitive information tbh
but i have no clue
x is your hostname, y is your instance name
So to make a backup of the database (no clue how big it is btw), how could I access it?
cant I just get the XML and make my own
you'd use something like SSMS or datagrip
are those built in VS?
nope and nope
they are database management tools
SSMS is the official one for sql server, and its free
oh lol turns out its in my computer alreaddy
the ssms one
login is alreaddy set...okay
So
I'm looking at the databases now
out of curiosity, if i fuck around here, will I get fired or something? are these the live stuff?
could be, no way for us to know
but likely not
or are these the local ones
oh ok
depends on the hostname
like, how much do you know about computers in general?
it seems you are... very new to most things.
I know a lot about memory, algorithms, datastructures, and how the computer operates
network wise
I know how packets work
but I never really learned a lot about network stuff
database wise... I know CRUD operations, and how to create databases
but stuff like what a hostname is?
the computer name in the network?
correct.
That what i think it is
Oh nice 😅
so given that you have the hostname of the db server, you should hopefully be able to know some stuff about it
like, is it local (localhost, 127.0.0.1, .), on your local network (
local.
or .local
(usually)), or external.\MAGICWORD
there are no strict rules for naming, but hopefully it isnt just a random string
.
means its your local machine
so this is a local database running on your computerTHat makes sense, because I regonize a bunch of databases here I interact with Delphi, and they were all local ones
So
if its local
I can mess with it, no need to backup
right?
the thing is
the
magicword\magicword
in the c# service
didnt have a dot
it wasnt like
.\magicword
butyou probably dont want to edit your structure, but the data should be safe to mess with
I think there is a easier way to address this
I'll just ask someone XD
1 sec
You have quite the task ahead of you, but to be honest you can't really expect us to hold your hand throughout the entire thing, that should be your senior dev, mentor or similar - not a bunch of strangers on the internet.
Yes I agree
Your task should however be fairly straight forward, if somewhat complicated by the fact that the current version doesn't run. I don't think its that much work to get it running, but your lack of basic C# and ASP.NET knowledge is blocking you.
So imho, try and learn enough C# so you can read the code. This will involve writing C# and experimenting with your API. Then, you can either try and get the existing thing running, or slowly porting it by reading+rewriting/copying parts as you go.
Yeah, its why I wanted to get the service running in the first place
so that I could start experimenting with it
to the thing keeps giving me 500 error
do you know what 500 stands for?
fast forward to now, im making a copy of a database? Xd
stands for... error :p
"internal server error"
ohh
So thats why
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
^
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
btw the database I cant mess with it, its not local
I need to make a copy if I want to mess with it
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah so dont. change the conn str
you have a local one set up
so connect to that
I do?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yes, you said so?
when you started ssms
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I understand that
the thing is
In my local databases
I didnt found one with the name
in the conenction string
its just a log table
iirc serilog creates it for you, if it doesnt exist
so likely, its enough to make a blank db and change your connstr
how do I do a blank db?
ugh
Come on
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
sorry I'll search online
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ah right, the
nif
and stuff was in the contextUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
I do have a
Audits
folder inside a Security
folder
No clue if thats related to anything thonot related
:/
wait
In the tutorial I followed
they used a memory database thingy
like the database stayed in memory
You need to learn a bunch of stuff. Like how databases work, what EF Core is and its basics, etc
cant I use something like that?
in theory. change your context registration to use in memory db instead of sqlserver
but like, porting a .netcore31 app to .net 7, without knowing C# or .NET at all, will be rough
as you are seeing
did you try getting it running as a .netcore31 app first?
yes, error 500
and you used a debugger to see why?
no
so do that
where do I p[ut the break point? in the place with the connection string?
"error 500" just means "something went wrong"
program.cs, first line
or just nowhere
but run it in debug mode, and it should stop at first exception
okay
you need to get a rough idea of WHAT is going wrong
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
sure, it booted enough to start the http pipeline at least
no break
there is a weird thing happening tho
in previous services
when I started the execution
a tab poped up in my browser
this one nothing pops up
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
because thats a recent addition
I have to manually open a tab
not a problem
just do that.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I had that alreaddy I think
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
omg
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
When are we getting added to your company payroll btw?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Okay, im sorry, you dont have to help me
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see, thanks for explaining that
Is it normal to have many exceptions in these kinds of programs?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
nothing stoped
it just run as normal
I give up
I'll read some more stuff and follow your previous tips
Thanks for the help so far I really appreciated it
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It's fine lol, maybe the problem is me
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I just feel like its a lot of stuff and then I feel bad asking you guys stuff cause I understand its like you guys are being teachers
I dont want to anoy anyone
honeslty i just wanted this Service to run so that I could experiment with it
Maybe I'll try and ask the previous maintainer if he can help me, he told me to debug, but debug we saw that doesnt stop anywhere
maybe ill try the breakpoint thing
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It's kind anoying to ask him for help tbh, he never really explains anything, plus never gives documetnation on anything, he usually just says "read the code"
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
the original creator left, the project was passed to this guy that I refer to as "the previous maintainer", and now they pass it to me. He still works on it, but after I split the service its me
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
problem was that nothing was documented, no one knows what documentation was used to make anything, there is stuff about the service the guy before me also donest know, etc
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I basically "found out" it was a web service, originally I was making Backgourng Services thinking that I was making progress
xd
Noted
I'll start with that
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I prefer reading then videos, but ill take a look definitly! THank you for sharing
Entity Framework documentation
Learn to use Entity Framework Core, a modern object-database mapper for .NET that supports LINQ queries, change tracking, updates, and schema migrations. Browse tutorials, sample code, fundamentals, API reference and more.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yes, but I thouhg a little and I also lack knowledge on EF
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Oh okay
Noted
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So it follows the .NET version
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see xd
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I'll read all that and watch the video and I'll return when I understand EFCore I promise
Thank you for the patience so far I very much appreciate it, now it's time for me to put in the work
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I wont be fopcusing much on code tbh
I just want the theory
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Out of curiosity, I see a lot of things that go in the
[]
's before declarations
thoes that have a name I can look for?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Noted
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
That is all new to me, the annoptations consept, I'll catch up on that too
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see...
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see, its a way to mark functionalities to the otisde
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah that makes sense why its a bad idea XD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I'm honestly kind of hyped to learn all this, I was always intimidated by database stuff so I stuck to learning things that were more comfortable to me
But now after talking with you and seeing that stuff is well documented I think I can learn alot
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see
I wont touch the service for now until I understand EFCore
So I did some reading and now I'm following the video you posted above
I ran into a issue
I installed the NuGet packages regarding EntityFrameworkCore
yet he is not recognizing the things
The suggeested options tell me to install a EntityFramework package
but EntityFramework is the old one, right?
Am I missing some step?
if you check the "quick actions" on either of those errors, does it suggest "Import missing types" or similar?
The thing is
Install package 'EntityFramework'
I dont think this is Entity Freamework Core
I think it could be the old one, right?yeah, you dont wanna do that
Maybe Im missing some using?
the video deosnt show the usings part of the code
hmmm
VS should suggest the usings if they are available
are you sure the nuget is installed in this project?
I installed the ones the video showed
that should be enough yep
I'm using .NET 7.0, could that be the problem?
maybe there is no DbContext in .net 7.0?
using Microsoft.EntityFrameworkCore;
I tried that but
DbContext comes from there
not from .NET itself
it comes from that nuget, that namespace
EntityFrameworkCoreMWE
is the name of my projectit cant find the nuget for some reason
if you run "dotnet restore" in a terminal in your project root, what does it say?
okay...
thats weird.
:(
only one project in the solution?
Maybe it's the project type?
I created a
empty was a bit overkill, but not a problem in itself
and if you expand the "dependencies" there
and then "packages"
no EF core
:O
but I installed?
open your csproj
They are here
hm
ok, restart VS
ok
it must have an invalid state
Same issue after restarting
Why does nothing that I do work i swear to god
wait a second
thats showing "program.cs"
show your program.cs
I was following the video
I'm thinking you are mixing top level statements...
ah
ok you are not mixing it
but its unusual to mix things like this. and please use file scoped namespaces 😄
So, make a file, open namespace
EntityFrameworkMWE
and type there?
So the end goal would be more separated code?you should have a quick action on the
namespace EntityFrameworkCoreMWE
line
that says "convert to file scoped namespace"Okay I did that
good. Now check the quick action on
DataBase
you should have a "Move to Database.cs"Yes
Okay i will do that
great.
OKay it created a new file
and moved the things to that file
yup!
I did the same to
Message
normally you only have one type per file, but its not a hard requirement
if two classes strongly belong together, I let them be in the same file
I see
The issues all come from the DataBase file now
question
If I manually create de Models folder
and move Message.cs there
Would that be good or bad?
you'll need to update the namespace
but thats fine
Oh ok
namespaces should reflect folder structure
Oh I see
Im really not sure what the error is here thou, you clearly have an EF reference but it doesnt work in VS for some reason
try
dotnet build
in the terminal
see what it saysa lot of red
its still saying Program.cs
Odd
did you leave a using behind there?
I dont thing so
oh
look at the very top lol
its right there :p
omgefnskfd
still, no idea why its not working
maybe c# dislikes me
maybe I'll just see the video without making code
and believe that it works XD
no, you should fix your issues
nugets are resolved as dll files
does your output directory contain the EF Core dlls?
i dont even fully understand EFCore, how am I suposed to fix something that I dont even understand why its breaking 💀
let me see
its not breaking, its not even starting
this isnt a code issue, its a tooling problem somewhere
This?
no, up one step
then "bin"
nothign there
i searched in the binaries frist but i didnt find anything
hm... comment out your dbcontext for now
so i tried the obj one
ok
so that your project builds
dotnet build
verify that it actually buildsok
Progress!
now go bin/debug/ etc
and check the dlls
There is one
thats yours
Yes
I think
it has the project name
you are missing these.
the EF dlls
that's alot of files :/
so we need to figure out why
dotnet restore
isnt working right
you're sure all files are saved properly?I think so yes
like, your csproj isnt actually empty on disk?
let me check
if you open it wiht say notepad, it has the package references?
yes it is not empty and has the packages references
dotnet nuget list source
run that.ok, thats the expected result...
wtf
xd
I can try making anew project
try this
dotnet nuget locals all -c
then dotnet restore
okay, now your cache is clear
so try a dotnet restore
ok, and
dotnet build
, then check your bin folderthe code is still commented, correct?
the database one
should be ya
Still missing
:/
very weird
Troubleshooting NuGet Package Restore in Visual Studio
A description of common NuGet restore errors in Visual Studio and how to troubleshoot them.
try this
ok ill trya nd see if it fix
I noticed something
Is it normal to have the yellow thing?
nope
I think its because
they are unused
no
shouldn't be.
They appear selected
when I click on "remove Unused References"
Hm, thats a new window. Never seen taht before.
But lets not remove them.
ok
go to database.cs again
and try manually typing
using Microsoft
and using the autocomplete, does it not suggest EntityFrameworkCore?Nope
¯\_(ツ)_/¯
I have no idea.
C#, the C is for Cursed
I will try a new project
Maybe I did something wrong
when creating this one
idk
LOL
fixed it
@Pobiega I unnistalled the packets and re-installed them
and now it works
hehehe
thank you for showing me how to approach this issues!
That makes no sense.
I noted down the process
Did anything change in the csproj?
nope
its the same
mystery
So I wasnt able to get the database running xd
I got error 40 and after some research I was kinda lost
then I went and read alot about migrations and damn its a very clear thing, i liked knowing about them
now Im back to the video and have a question
This is a screen shot of a part of the video
the line
await using var db = new Database();
ignoring the part about await using var
cause i dont know about any of that yet, but what is he doing here?
is db
a Session?
what I think its doing, is basically "connecting" us to the database?
so basically, we can then mess with the Database
object like if we were doing CRUD stuff, is that it?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
:(
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I think he was just showing stuff
around 30:00
actualy
around 24:00
sorry
i need to go to college now i have classes after work but ill be on discord there
I also have a second question I didnt really understand from teh video
What would happen if the query gave no results?
Would we get an exception?
or nothing would happen?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yep
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see...
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
@TeBeConsulting I wonder how we could change the default value to something other than null? I guess we could use null coalescing operator:
anything nicer we can do?
could do something like that, but its not a very common case, since this is fetching from a database.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
so you'd want to add the new entity to your tracking
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
and the GetOrAdd() method would be using null coalescing operator?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
cool, thank you
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
mhm okay
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
could even register the returned object with the dbset before returning it, if you wanted
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yep, that would work
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
if you are really fancy, you'd ofc provide a non-async factory version too. overloads are nice 🙂
couldnt this be refactored to:
??=
wouldn't work there
but ??
wouldUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh, then
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
almost codegolf at that point :p
why not tho?
because thats an assigment
??
is just "take right value if left is null"
??=
is "assign right value if left is null, else do nothing"this should work right?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah I understand 🙂
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
tebeco#0205
REPL Result: Success
Console Output
Compile: 539.566ms | Execution: 27.839ms | React with ❌ to remove this embed.
tebeco#0205
REPL Result: Failure
Exception: CompilationErrorException
Compile: 589.724ms | Execution: 0.000ms | React with ❌ to remove this embed.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
how about this one xD goddamn I love c#, there are so many cool ways to write this
but also kinda makes it hard to choose one
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i just took what you had as the method's definition but yeah
makes sense
right, edited xd
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
A model is made up of entity classes and a context object that represents a session with the database.
Isn't a Model just a class? I don't get the "context object that represents a session with the database" part
Wait, do I have to have a Context for each Model?
So for example
?no
Or only if I have a database for each?
you usually have one context for an entire project
I see, yeah this is what I though
it contains multiple
DbSet
sDbSet meaning a table in the database
right?
something like that
one dbset corresponds to one entity
but that entity may potentially span more than one table
usually thou, its fairly 1-to-1
I see
Makes sense, thanks
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
hot damn this thread has almost 2k comments
don't bother reading it, its really not that interesting
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
But it would make sense if I wanted to connect to other database, for example I think
Since form what I understand, a Context is relative to a database
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yes, I agree I gave tat example to make clear
since in the documentation the gave a name to a context that was related to a Entity
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah okay
o7
Also, I see code like this
In he video he also used
using ...
and assgned objects to it
What is the meaning of using
in this situations?
Is it just to force destruction of a object?
Does it mean the object wont be managed by garbage collector?
Or just that that instance will be invalid after the scope ends?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah I understand that part now
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So I assume its good for the context to use
using
, correct?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
because we want to have more control over when it will be disposed
right?
if you use it like this, yes.
but normally you dont use it like this
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
O
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah, i though about "damn do I have to write this every time" xd
especially in a web app, you will never ever see
new BloggingContext()
you inject it insteadthats a new thing Ill have to learn aswell
and that means the service provider takes care of object lifetimes, and in a web project that would be the request scope
Okay, thanks for explaining, back to reading 📖
The
using
statement is basically syntax sugar for closing connections, disposing of instances wrapped in the using
statement.
E.g., you wrap a File writer in a using statement. This ensures that the file is closed, once you are done writing to it. Without a using statement you'd have to write that yourselfusing statement - ensure the correct use of disposable objects
Use the C# using statement or declaration to ensure the correct use of disposable objects
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
To me syntactic sugar means an easier alternative to write certain behaviour, which ends up being lowered into the same thing.
Considering
using
is lowered into a try-finally, I would call it the syntactic sugar of that, since it's an easier way to write it.Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
That's whole different behaviour altogether which would not be related to the
using
block lelUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
Is it the equivalent of doing siomething like
?
?
This thread is still going
what exactly would this hypothetically be equivalent to?
the outer scope does nothing here, and the inner one simply limits the scope of
foo
, just like all scopes do.end of scope forces a stack unwind
so it would dispose of the stuff inside
oh wait c# doesnt put objects in the stack
i keep forgetting
it wouldnt dispose either way
if an object goes out of scope, it will eventually be picked up by GC
wait no, it would work cause no other ref was holding the obj
but that is not the same as disposing
IDisposable.Dispose()
is a specific methodIsnt Disposing what happens when the objects gets collected by the GC?
no
Oh
not everything can be cleaned up nicely by the GC anyways
unmanaged resources, like window handles, file handles etc for example
thats why
IDisposable
exists, so you can handle that stuff yourselfYeah i know
does implementing IDisposable mark the object as unmanaged?
it should honestly
it doesnt.
cause if Dispose isnt called in destruction
I have to make it call Dispose, right?
not have to. but in most cases, should
HttpClient
is a good exception.
you should not be using var client = new HttpClient()
, everwhat I mean is, if I dont explicitly call Dispose, or do the funny
using
thingy, will something call it for me?
why not? ever?CA1063: Implement IDisposable correctly (code analysis) - .NET
Learn about code analysis rule CA1063: Implement IDisposable correctly
look here for how to implement IDisposable if you have native resources
native resources are resources I make, right?
no
its unmanaged stuff
like
IntPtr
in this casewhy are they called native resources? kinda weird name
unmanaged resources would be more clear
its native because it belongs to the OS
managed resources are managed by the CLR
but tbh, stop worrying about this lol
this is so beyond what you are doing
managed resources are managed by the GC tho
CLR starts the GC
the GC is part of the CLR
why are you splitting hairs?
GC was the topic i read the most about when I knew about c# a few days ago
its very interesting
the way it works
Sure, but unrelated to your current problems and tasks.
it helps me understand things if i have a clear definiton of what hings are
I know
but if I dont know how things work, do I really know the things?
Sure. But do you need to know quantum physics to ride a bike?
No :)
You already have a huge task ahead of you, don't make it larger 😛
you can learn the details on GC and managed/unmanaged stuff later
maybe its just my brain trying to detour from the main task cause im stuck again
oh well
back to reading
I only have one project here i think
Why cant I add a migration?
omg
the goddamn backup file
yarp
todday is the day I try to get a migration working
yesterday i tried but
I got error 40
I don't know what error 40 is.
I know most http status codes by heart, but not everything else :p
it was a error not in the browser
but like in the command shell
lwt me see if I can reproduce
likely a SQL server error?
Error 40: Could Not Open a Connection to SQL Serveryeeep.
It was when I tried to update the database
The command was
dotnet ef database update
So yeah, I was unable to follow the video from thereseems pretty clear to me what the error is
buuuut
my connection string is good i think
its not, or your server is offline
I'm going to make a very noob beginner question
Microsoft SQL Server Managment Studio
SSMS, yep
Is that my SQL server?
nope.
Its just a program that manages databases?
its a program that connects to SQL server and lets you do stuff in it
yes.
So I have a local SQL server?
lLike in my computer?
probably? maybe? I dont know?
looks like it
it has a IP in front
that isnt 127.0.0.1
wdym in front
thats not an IP
thats the version
Oh.... hehe
oh okay
This is mine
So if it was local
I should see a icon
in bottom left corner
right?
no, it is local
how do I know? because the hostname is
.
nah, it likely runs as a service
press ctrl+shift+esc
go to services (the plugin icon)
see if you find it in your services list
Any of these?
I run mine in a docker container on WSL, so its slightly different
well, those are related to it for sure
those are the only ones I have that have the text SQL
okay, well it doesnt really matter
change your connstr to
Server=.\SQLSERVER
give that a spin.SAme output
error 40\
when you start SSMS, what do you put in the "server name" field?
.\SQLSERVER
then that is what your connstr should have
Ohh okay, noted
wait, is that your entire connstr above?
or did you remove the userid/password fields?
do thaths it
ohhhh
omg I forgot about the password
sorry
Ill add that and see
Goddamnit
Same issue
hm, it cant even get to the login part
your computer seems a bit cursed tbh
first the weird dotnet nuget restore, now this
true
everyuthing i tried so far as failed with erros
sucks to be me
But SSMS can connect and manage the server just fine?
I mean... yes
Iºmn not understanding something
Why is it that the original project (the service), doesnt have a DbCOntext
he uses theconenction string in the Startup.cs file
It did thou
in this function
not in a class that inherits from DbCOntext
Thats how you usually do it
So why are the tutorials using a class?
ohhhh
it used to be in the class
HelperContext
but its commented there
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
So maybew it was originally in the class
but it was changed to the Startup.cs file maybe for security reasons?
I mean the string is still there so idk how that would improve security but ok
So this line appears in that big output
from the console
maybe its a clue?
How can I verify that the SQL Server is configured to allow remote connections?
I mean its local tho
i dont know :(SSMS working is the key bit
You need to figure out why
Is there a way to "ping" the sqlserver?
just to see if its alive
I want to see if I can reach my local server before assuming the problem is in the connection string
I mean, sure if the SSMS can connect, it should be alive
Login works fine and it shows the dates and whatever
but like
outside of SSMS
You don't ping a server, you ping a host.
The equivalent is connecting to it
so I would run the command "ping <hostname>"?
in this case
But the hostname is .
Aka localhost
ping ./SQLSERVER
That's not your hostname
Hostnames don't contain slashes
I see
Okay i used my hostname
and it replied
so that is good
i think
.... Did you ping localhost?
that is my computers hostname
I dont get why my connection string is
<hostname/SQLSERVER>
and not just <hostname>
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
well yes but
I have N databases
SQLSERVER is a database of databases?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
in this case, my local mahcine
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So if I can ping my hostname and i get a reply, it means the server is alive
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
in the server (my machine), I have 1 or more SQLSERVER instances, and each instance can have 1 or more databases, is that it?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see....
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
This is the problem im having since yesterday
I try to run the command
dotnet ef database update
I made the migration successfully
but it cant connect to the database
my conenction string looks like this
Server=JULIOPACHECO/SQLSERVER;Database=EntityFrameworkCoreMWE;User Id=sXXXX;Password=XXXX;
oh wait
the password
is incorrect
wtf
1 secUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
no the password is corerct....
I tried giving the connection string in the command
Still failed
and you have tried
Server=.\SQLSERVER;Database=EntityFrameworkCoreMWE;User Id=sXXXX;Password=XXXX;
?username and password are correct
Yes
still faild
with the . and the backslash?
omg
wait
it faild but
difernt error
omg my hopes are back up
i was starting to question my existence
have you been using a forward slash the entire time?
yes :(
NGL, getting a bit tired of you not paying attention to details
I suggested
.\SQLSERVER
from the very start
and you said several times you tried it and it didnt worksorry...
So SSL is a cerificate
SSL is .. a lot more than that
but it uses certificates
so SQL uses a SLL certificate
and the certificate is not trustetd?
i asked GPT
is tehre a way to check the certificates?
TrustServerCertificate=true;
in your connection string
since this is for a local machine, this is fine
its not fine for a remote connectionOMG
it worked
Also, please stop using GPT as a google replacement
its not a google replacement
it doesnt know facts
I didnt! I was just for the errors i was getting :(
I dislike GPT
it predicts text sequences
I know :(
But desperate times make desperate measures
that top link contained the answer
O
yeah GPT wasnt very helpful here
So why are you defaulting to it over google?
or bing, or DDG
I DiNt
I literally just used it for this now
i didnt touch gpt for the past days i talked here
okay, your connstr is finally fixed, so now you can get started with EF
yes, finally...
thank you for the patience
sorry i annoyed you
i didnt mean to mess up
beacuse you don't normally have a fallback connstr hardcoded in your application, as I mentioned before. You read from the config, if it isnt there, you crash (intentionally).
because that means your app is not configured correctly
this would be the appsettings.json?
sort of.
not really, is the real answer
because that file is usually checked in to source control
and you dont want your secrets in source control
you'd use user secrets or similar locally, and when deployed you'd use environment variables or a keyvault or something
Noted
One question
Lets say that I have 3 classes in my program
and I only put one of them in a forthe class (the context class)
?
So in it I would only have one DbSet<A>
?
When I made a migration, would It only create one table in the database for class A?
fourth*
"put them in", you mean by making a DbSet property for it?
My question is, will the migration only make the tables for the stuff I register in the Context?
yes
yes
ahh okay that is nice
however, if you make a
DbSet<A>
and A
has a list of B
in it
then it will create tables for both
since B is required for A to make sensethis would be a 1-N relation?
yes
I see
So We use lists for that
or many to many, if B also has a list of A
okay
Some kinds of relations require a third table to be created tho
would It do that?
Or would I have to help it?
yes
no
okay okay
EF will figure it out on its own, most of the time
but we can help it or guide it to do things the way we want
thats done in the
OnModelCreate
overrideI see, thats a bit more advanced tho, ill get to that eventually, just curious :)
Ill go back to the video and the documentation
im happy now
finally got something to work after 4 days
Left side is my project, right side is the original project
I'm slowly adding file by file
I installed the NewtonJSON package
but the IDE is not recognizing it
I have the same
usings
The only thing that is differente is the .NET version
the original project (right) is using .NET Core 3
and my project (left) is using .NET 7
Any thing I can try?
The quick actions dont solve anythingI also have a similar issue with
logging.AddFile
in the Program.cs
file
Maybe the .NET version is the issue?very odd https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.newtonsoftjsonmvcbuilderextensions.addnewtonsoftjson?view=aspnetcore-7.0\
This says that I should have the method I think
not sure is
ASP.NET Core 7.0
is just a fancy way of saying .NET 7.0
but idkASP.NET Core 7 is the latest version of ASP
.NET is the CLR , asp.net core is the web framework
I would recommend you try not using NewtonsoftJson in the new one
.NET has a new JSON library called
System.Text.Json
since a few versions ago, and its much faster and modern. It doesnt have all the features of newtonsoft just yet, but it does handle most everyday usecases.Well
the things is, I dont really know enought to replace existing code using Newton with that
well actually
its only used there
in that situation
in the
public void ConfigureServices(IServiceCollection services)
well, it does a lot more than that.
maybe I can try using that neew one
that
AddNewtonsoftJson();
thing registers newtonsoft as the default serializer
but tbh, you likely wont notice a differnce, since there are no newtonsoft specific configurations being applied there
and without those, they behave more or less the same
you'll just need to look out for [JsonProperty]
(newtonsoft) vs [JsonPropertyName]
(STJ) and the likesthe project doesnt use
[JsonProperty]
anywhere
So I think its fine?Is this one the equivalent?
even if it did, you'd just need to add a
Property
and you'd be done.I installed the System.Text.Json
yes, but if you dont specify any options its there by default
you dont need to
STJ is part of the .net base library
O
So
its the default?
okay
I see
So i just delete the Newton and delete the line cause the error
okay
So I remember we talked about this some time ago
But I didn't really understand anything
dont use it
just skip that line entirely.
just straight up delete okay
its most likely an attempt at optimizing the api
"Enables full buffering of response bodies. "
but just from going to .NET 7 you will likely increase the request/second rate by a singnificant rate
and from using STJ instead of newtonsoft too
Okay, out of curiosity, what is the default behaviour?
wdym?
Or, same question but from another angle, what does it mean to "full buffering of response bodies"
I have no idea.
it was an experimental package that never left prerelease
Oh
Maybe that's why in .net 7.0 i cant find it in ide
maybe it doesnt exist
anymore
it only ever existed for a very short time
I had never heard of it before you and tebe brought it up
Xd
same Xd
btw what do you think about my plan
my plan is
to make a migration
since I have no clue about the tables
but I do have the objects
Im going to try and make a migration
and then make EF make the database locally
so that I can mess with the service and have a working database
is this a good idea?
yes
FINALLY I say something that makes sense
I'm learning :D
I'm down to one last error
This happens herer in
Program.cs
Is this also something that deosnt exist anymore?
Also, how can I tell if something no longer exists?
BEcasue i might encounter this issue again eventually since the code is really old
Microsoft.AspNetCore.Buffering 0.2.2
ASP.NET Core middleware for buffering response bodies.
I see
Ill save that link
for future
anytime you see a package, check it up on nuget.org
if its an official microsoft package, and its version isnt
7.xxxx
then you should take an extra look
when a new .net version comes out, all core packages are released with the same major versionThis one is still alive
But I get error?
This is regarding the
.AddFile
that is definitely still alive
you are using it the wrong way
the API has likely changed since .netcore31
Oh
so what you do is look up the docs
and that leads you here: https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.iloggingbuilder?view=dotnet-plat-ext-7.0
So they removed file support
looks like the file based methods were either removed or moved to another package
to google we go!
"LoggingBuilder add file"
How do I know what to search for? I ask this because this is being done in a specifi place
in a configuration
how do I know that something "will fit"?
check the type of
logging
ILoggingBuilderr
no
wrong
yes
correct
start with "C# <type name> <your thing>"
Serilog.Extensions.Logging.File
or
FileLoggerProvider
in Orleans.TestingHost.Logging
Serilog absolutely can write to a file, but that is a different logging framework.
from what I've found, it looks like M.E.Logging has entirely dropped file support
Well
However, serilog is... amazing
cant I just log to console
so you could just use that
sure you can
or you add serilog in "adaptor" mode
where it wraps M.E.L and takes over logging
but your applicationcode still use M.E.Logging, but you can log to console, file etc
Logging is a pretty new concept to me yet
if I do
Add it to your list of stuff to investigate 🙂
logging.AddCOnsole();
will it log to console?
Will do!Serilog is considered "best practice" and industry standard tbh
yup
So it means that, when I start my application, it will open up a console and start dumping things threr, right?
even if my project is not a console application?
kinda. it would open the console anyways.
no
it only works on console apps. But luckily for you, web apps are console apps.
They are? oh
ofc they are.
i though they were browser pages or smthng
since I access then with a link
jfc my guy
you lack some serious basic computer knowledge >_>
a backend web app listens to web requests and responds
it isnt a browser, or a page
its the thing that answers the requests
Ohh i see
its still a program, so it needs to run somewhere
So its output is stdout
I mean
sure.
the console
yes
ok ok
but inside the app is a HTTP listener
where it accepts http requests, and returns http responses
i see
well myu boss just came near
and told me i cant use discord smh
imma die
im going to read documentation and write down my questions :(
when I get home I will aks things
sorry i have to leave apparently
goddamn it :(
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
"Since no one at the company is helping me with anything at all, I got these french and swedish dudes teaching me everything from C#, networking, databases, asp.net, ef core, how computers work, how to troubleshoot and much more."
@dryfish please try and find a new employer
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Discord is pretty commonly disabled due to causing procrastination
Blame other servers that are not helpful 🤷
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ideally the goal is to make sure everyone has what they need to move forward with their tasks, ie not be blocked by something, and other people pitch in to say "I can help with that".
usually its just used to say what you did/are doing so the PM feels that they are involved 😦
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Hey guys
I'm using discord on phone I'm on a food break
They can't control what I do on my breaks
So I managed to do a bunch of things actually
I'm having a few problems tho
When I navigate in browser to a route I get an exception and the breakpoint doesn't stop in the controller
I suspect it's cause I'm not registration the Json service properly in the program.cs
Anyways, in my lunch break I'll dump here some questions I have maybe someone can help
I have to go now they are coming
Brb
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Okay guys Imma dump some question I noted down, ill read them when I get home
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
1- Why are methods in Controllers not marked as async? Are they implicitly asnychronous?
2- What are the methods in the Controllers supposed to return? and what is a
Task<IResult>
?
3- Is it enough to jsut change the return type to a JsonResult if I want them to return JSON? It works if I do that, but I dont get what kind of magic is happening
4- Why is the connection string behing used in the ConfigureServices
in the Startup.cs
file? What do Services have to do with connecting to the database?
5- also, why do they call Services to the helper classes? Its just a class that does soemthing?
6- what should I return if I get a invalid input, of a method in the COntroller that returns a JSON? is there some standard I can fallback to or just return null?
7- What are the future implications of not having a Model that deosnt directly represent the database? For example, I found out the model has more fields then the database we are using, and when We convert to JSON the extra fields get the value null. I mentioned this and they told me maybe the database changed?No one really knows wtf is going on so Yeah, I wrote down some thing I think might be bad in the future but idk appreciate someone who knwos better to explain this
Also
I solved the issue I was having and managed to get the thing running
However I did some things that I think could be done better,. For the Service problem, the registartion was giving me the execption. I was using the MS type JsonResult
like tihs: //builder.Services.AddSingleton<JsonResult>();
I solved by doing this:
And in the Program.cs I did this:
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I saw a video in the .net yt channel that shwoed something similar and I tried it and worked but this is wwhat the previous guys did in the code and the viode is 3 years old
So is tehre a better approach for this so taht I dont have to use the useless type
JsonService
>?
Okay guys I gotta run now before I get caught
Illr ead everythigng wehn I get home I rpomise
gotta runUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
1. Nothing is async unless specified with the
async
key. Controller methods are synchronous by default but you can make them async by adding the async
keyword and returning Task
. .NET will then invoke it asynchronously.
2. This really depends on use case. Mostly you can return IActionResult
, but you can also return ActionResult<T>
where T
is the type you return. This is useful for programs like Swagger to understand what an endpoint returns.
When returning an (I)ActionResult, you need to specify the status code. NoContent()
returns a 201
, and Ok(T)
returns a 200 with a returned object for example. There are a lot.
You can also just return any Type, which means that you have no control over specific status codes, and you're not required to pass Ok(T)
or something.
3. Yes, I believe if you make it an (I)ActionResult
you can return Json(T)
and your endpoint will also indicate JSON is returned.
4. I didn't read the convo, but you inject a database context into the list of services the application can use. This is called dependency injection. The idea is that you specify your settings once, for this collection, and anything supporting dependency injection can then request a transient, scoped or singleton instance of a dependency, which is then used there. In this case, a scoped database context is used for each request to communicate with the database. I strongly recommend you learn about dependency injection.
6. Same as point 2 and 3 I guess. You can return json(T)
for a valid result. Otherwise you can return badRequest()
, assuming the user did something wrong and assuming you're returning an (I)ActionResult
.
By default, your API will return an InernalServerError if something goes wrong, and you did not handle it.Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Heyo guys I'm back
Imma go thru each anwser, thanks for the replies btw
fcken have to do this on the weekends cause no other change to use discord while im there during the week xd
well, atleast i'm enjoying learning all this honestly, so it's fine :)
yeas, both I think
So, currently I have this:
So you're saying that, If I don't specify the async, it's not async?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
(This code is inside the Controller)
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yes
Input Output
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Blocking
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
:(
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yes all that is a form of I/O
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
reading from console too
but thats a stream
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
you areladdy menitoned stream
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh
really?
interesting
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Some streams could be just for I and others for O, is that what you mean?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
okay i will
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
This is also some thing that after I read async for C# i didnt really understand, so I get that its a language level asynchornization thingy, but what does that actually mean? does it start a thread if I do something async? and what if I use the thing I asynced before, does it wait there until that imaginary thread finish?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
TLDR on
async
/await
:
* every .net API that is suffixed with Async
(eg: .Read()
and .ReadAsync()
) => use the Async
version
* if the API name ends with Async
=> await
it
* if the API returns a Task
=> await
it
* if you have to await
in a method:
* that method must have the async
keyword (you could even suffix your function name with Async
, up to you)
* if it was returning T
(eg:string
) => it should now return Task<T>
(eg: Task<string>
)
* APIs to ban and associated fix:
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Well, but why? I get that the goal is to not get stuck on I/O, but what is actually happening when I use a
async
thing? Does the main thread start a new thread and pass that new thread the context (not talking about BD context here) and the new thread now deals with the request, freeing up the main thread to listen to other requests?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So I should only mark functions as Async when I do I/O in them, else its overkill or bad use of resources?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
TLDR on
async
/await
:
* every .net API that is suffixed with Async
(eg: .Read()
and .ReadAsync()
) => use the Async
version
* if the API name ends with Async
=> await
it
* if the API returns a Task
=> await
it
* if you have to await
in a method:
* that method must have the async
keyword (you could even suffix your function name with Async
, up to you)
* if it was returning T
(eg:string
) => it should now return Task<T>
(eg: Task<string>
)
* APIs to ban and associated fix:
That doesn't explain my question I think
I was asking about how I should decide to mark the function as async
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
From what you explain, I think that I mark a function as async if I do I/O inside it, is this correct?
Hmmm
The thing is
Im looking at the existing code now
The function is not assync
but in it they query the database
and no Async used
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah this is what they are doing, a
.FirstOrDefault
, but no await
usedUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
tebeco#0205
let's take SaveChanges/Async
Quoted by
<@!689473681302224947> from #Understanding project structure - Visual Studio ASP.NET Core (click here)
React with ❌ to remove this embed.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Out of curiosity, if Async is the one that should be used, why do they support the non-Async version?
A better question is, in what situations would I want to use the non-Async version?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah, I was actually wondering in schenarios with alot of trafic, if I really wanted to use async, or would waiting for I/O be prefered
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see
So what I registered from this topic:
If I do I/O on a function, I mark it as asyn and return a
Task<Return Type>
and I use await
for stuff that end with Async
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Noted
Iºm trying out the things we talked bout
oh wait
i think its in the wrong place
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
nvm
yeap my bad
Yeah so I keep getting these kind of stuff
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
"X" is not null here
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I added the Task but forgot the async 😅
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
But
isnt the controller only called
by the browser, when I nagivate to the route?
I mean, not the brwoser
but like
when I make a request to that endpoint
isnt that the only place?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
have a nice meal sir
So
I have now corrected the function
This is what It looks like now (this code is from the Controller btw)
The next thing I wanted to try and fix todday was the Json part
Cause you guys told me a lot of times that I didnt need to have a class for this
This is what I currently have rn
And then I request a instance in the controller, like so:
If I try the mentioned approaches:
So I'm clearly didn'd understand I think you guys told me
I read in the internet that I need to Register my Services
Is something that converts Objs to Json not a service?
Or is it a Service that ASP.NET offers for free?
Do I need to request it in the Ctor of my Controller?
Didnt we already establish that you should delete your jsonservice
Make your endpoint method return whatever type
first
is (Task<Whatever>
)Well
You told me but I didnt really understand why
So I woulndt say its "established" technically
Oh
Well
It's reaturning a
JsonResult
Isnt this the Json type?Wait no, im dumb
You should solely return an
IActionResult
:P
An IActionResult
is a catch-all for all kinds of responses
Ok()
, NotFound()
, BadRequest()
, etc. etc.
By passing in your object to the Ok(first)
call, you're telling it what to return to the requester
By default it is always returned as json. It will handle that for youOhhhh
I was lacking this part of information you told me
"An IActionResult is a catch-all for all kinds of responses"
So hold up
One thing I dont understand
I was not returning a IAPlicationResult
but it was still working
I was getting a response
Why is that? What kind of magic was happening?
IActionResult
is the untyped interface for all http responses
so if you have return Ok();
thats a valid IActionResult
but so is BadRequest()
and all the other helpers
(including JsonResult)So Everything I return from a HTTP method is implicitly converted to a IActionResult?
not converted
IActionResult
is an interfaceOh right
So wait
That would mean that
I can only retun types that implement IActionResult, correct?
(in the HTTP methods)
It workss
Damn I had no Idea
I mean you guys told me i know
but only now i understand
Well, in an API controller you can return anything
and it gets serialized
by default to json
And I assume that Json implements the IAplicattionresult, right
thats why it works
not really
Like, if I return a
MyClass
that has no baseclass or interfaces implemented, it gets serialized to json by the http pipeline in asp
its not related to JsonResult
or the other result types.So I assume that the advantage Of returning a IActionREsult is that I can specify the return error? Ok BAd, etc
By default it [a result object] is always returned as json. It will handle that for youYe
yep
I seeeee
if your only returns are 200 (with content), 400 (bad req) (by the model binder) or 500, then you dont need to use IActionResult
And If I dont return a IActionResult, the result will always be Ok() ?
but if you want more direct control over the returned code, you do
no it will be 400 if the model binder fails, or 500 if you throw an exception
It's a no brainer default tbh
O
So
I was following some documentation
to help me migrate to .net 7.0
and Alot of things I did and are way more clean now
I only have the Program.cs file now, no more Startup.cs class
but there are something I didnt knew how to migrate
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I fixed the code I hope its not :(
This is my version
I'm new to C# so be gentle :(
The previous version was AIDs and I didnt even need to know C# to tell it was bad, I had to remake it
Is it bad? Xd sorry
idk what it does on first sight, so that's already meh for me
It calculates a checksum
basically
nif is a special number
you can tell if its valid by that formula
index < 9 - 1
so... index < 8
? 😄I did that to make it clear the intent
Its common on code with magic numbers
I prefer just naming my magic numbers
9 every one knows its the length of the nif
so do that
const int NIF_LENGTH = 9;
Screaming case
idk, used to it for constants.
Will do :) thanks for the sugestion
kinda wierd the name tho, i might use a differnt one
since the parameter is called nif
people could read it and thing its the size of the parameter
idk
No need for ElementAt, you can index strings
Oh right
Do I need to mark this function as async?
Since it will be called by a async function?
no
nah probably not
yep just wondering
dont make sense
A function only needs to be async, if its contents are async
async code can call sync
sync cant call async
I see
noted!
Btw
the thing I was mentioning
migrating
some things I didnt know how to do
and one thing I didnt understand the meaning
even after some search
so ill start with that
I'm not sure I need this
if i understand what it did exaclty
I think this is to say that my application will make requests to other websites?
idk
This service wont
Cors allows sending requests from the frontend (browser) to other sites
If it was there before, you will likely still need it
from the frontend?
SO like
Yes
locally?
No?
browser is local
:( I didnt understand
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
You can only send a request from the javascript side if the server allows Cross-origin resource sharing (CORS)
If a frontend wants resources from your asp.net core server, while not being strictly under your domain, you will need to allow cors on your asp.net core server
SO it's to allow, for example, some javascript somewhwhere to request to my API?
I think, now I am double doubting myself
Xd sorry
Oh wait
I think its the other way around
Yes. Yes it also counts for apis
I think its to allow my backend to access other peoples stuff
just remembered my latest use case of cors configuration
no
SO you are saying that
If I make some random javascript
that tries to get info from my api
if in my api I dont allow CORS
the requests wont go thru?
Cause by default only my frontend can talk to my backend?
something like this?
Yes
this is only for frontend? weird
the other people backend also dont share my domain
so CORs would apply to them too, right?
Yes
So like, its for the whole exterior
that has its own domain
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
logging somewheere? no clue, the code alreaddy was made like that, i didnt change much
Yup, no explicit indication will just make it synchronous (you can manually make threads instead but let's not talk about that). To make it async, change the method declaration to this:
Your actual method does not need to change, but it won't do anything asynchronous if there's no actual asynchronous code that is awaited.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
But I'm probably late as fuck with my answer
a bit, but I still appreciate you! thanks
why?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
right, that
$
shouldnt be there
happens thoUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
@TeBeConsultingis slowly digging up our mate's company codebase and internals
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
XD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
whats the issue? i wanna understand :(
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Its all crap code tho XD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
will do
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
why you disturbing our victim's migration time
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
tebeco#0205
replace:
Quoted by
<@!689473681302224947> from #Understanding project structure - Visual Studio ASP.NET Core (click here)
React with ❌ to remove this embed.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
What was the original issue? Im curious!
And what does this fix?
wait
but like this I wont log the nif
or will i?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I dont know C# enought to tell what its doing with the string
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Honeslty, this is the only place in the project wherer they log anything
If i had to guess, its obsolete
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see... that's nice yeah
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Ill definitly read documentation on that, i wrote it down
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Oh I can query
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Do you recomend any particular documentation on this?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
XD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see... Noted
This makes the logs go to the console, correct?
Also, the last thing I dont get regarding this logging topic
Why do I need to request
ILogger<Type>
?
Why does it need to know the type of the thing? Im not even logging itThe logger will add the origin (that type) to the logs, so you can filter aftewrwards
Ohhhhhhh
Thats smart yeah
Didnt though about that at all
Kinda like
[Date] [Time] [Origin] [Severity]: [Message]
something like thatI see :)
Well i need to write down alot of stuff mentioned here
thanks for the patience so far guys
What a thorough thread explaining how asp.net core projects are structured
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
thisis actually the otehr thig i wanted to address
because not only there are some stuff I'm sure I don't need to do, I don't know which ones, and there are some stuff I didn't do that are done in the original project
This is what my
Program.cs
lloks like currently:
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Just like that?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Oke
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Oke
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
The
Json
stuff part I'll also remove
becasue I wont need that anymoreUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
what do you mean by re-testing?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It was in the orioginal project
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
that is from the original one
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
isnt it to allow external domains to use my api?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
what code do you want me to run?
like start the service?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
can I just do that on the live one?
the service is running as we speak in the cloud
the original one
i tried running the service in my computer but its buggy
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
can Postman do it?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
rip
wait
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
cant I do it?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
in my current service?
oh ok
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
PLAYCODE.IO
Javascript Playground (Sandbox, Repl)
The #1 JavaScript playground and sandbox to write, run and repl it. JavaScript playground is perfect for learning and prototyping javascript sandboxes. Fast. Easy to use.
Can I test with this?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Actually
it failed the first time
I tried on the live one and that worked
but on mine it failed
didnt even remove anything
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
the link to the one running
the api
idk
the endpoint
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I did this
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
in the link, if I put the one in prod it gets a reply
if I put mine in localhost it fails
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
JSFiddle - Code Playground
Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ok ill do that
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I didnt show everything the firtst time
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeap i think this is why
tehy told me the cloud provider dealt with all that
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Probably XD
yep its a bug
Hold up
they have this code
in the original project
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
XD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Noo, why?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
that sucks
infinite loading
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So many dogs :o
I played a game once called lost ark
it was similar to that clip
but it got hard and I had to quit xd
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
im pretty bad at games ngl Xd
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
okay now its good
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Why do I want to use swagger?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I thnik I dont need it becasue the original project didnt have it
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I am! :d
It that all I need to do to haev it?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh, ill add it then to try!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
imma do that rn to see
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Ok
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see.... I do this for all the profiles?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I was wondering that actually xd
I see, okay thats good
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Ohhh
That makes sense, I though it had to do with the Debug dropdown
like running in debug or not
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
xd
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah
after these changes
I think I broke something
cause its not replying the json
when I go to the endpoint
Ill have to look into what whent wrong
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Weirddd
Its complaining about IsValidNif
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
All endpoints need an explicit http verb like
[HttpGet]
, [HttpPost]
, ...BUt its not ment to be a endpoint
Its a helper function
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
indeeed
I didnt know that actually
that the public stuff was visible form the outisde
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Took a while tho
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
but its working now! this is so cool
Its a very nice UI
thank you for showing it to me!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i agrre xd
at first i wasnt understanding why it wasnt let me type values
Ah... had to click... xd
So the last thing Im missing from the startup
was the thing that I didnt put in my current startup
becasue
I didnt understand any of that
so i just... ignored it
It works finetho so maybe i dont need?
anyways
this is the part of the code i'm missing
i just want to understand why they did it
its basically getting time from somewhere?
idk
They call that in the Startup constructor
Do you not have any colleagues you could ask this
nope :(
the original maintainer left
he did most of the code
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
and left no documentation
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
captured and never released
they basically do all that
just to do this in the Ctor
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
thats it
plus the BaseCOntroller thing is AIds
Its very bad
they basically
made a type called
ControllerBase
that conflicts with MS ControllerBase
and they make the ControllerBase
inherit from Controller
Phaahhaha
Controller
is a MS type that inherits from MS ControllerBase
type
its a messUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
hell no
I have multiple 3k + lines files
Im separating piece by piece
and fixing one at a time
I have one working so far
10 left
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
on file is 6k lines long
367 lines
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
the consttructor
and nothing else
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
protected and private
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
not sure
because
its a bit weird
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
it seems like they are hand encrypting and decrpyting sha1 stuff
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Try again 😎
XD
I joke ofc
No clue what encryption this is decrpyting
but
this is a thing? idk
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yep
is in my profile
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i think
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I know its form sharing code n stuff, right?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
no clue
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
O
oke
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Ok ill try not to mess up :(
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
o7
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Good morning!
Every method as at least 1 reference
The version parts are kinda weird
I might be able to clean it up alot
It gets the version from this
no clue where this is going tho
That's th request query string accessor
Jesus Christ why does this thread have 3.5 k
Tldr: brand new to C#, asked to split a .netcore31 monolith to .net 7 microservices, gets no help from anyone at his job
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
instant run
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Exactly that :p
yes!
AtController
inherits from ControllerBase
(not the MS type, the one in BaseController.cs
)the think I dont get is where is it getting the version from
Wait hold up
what is the meaning of this? Try to get the version, if fail it gets the value in
ApiVersion
?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Sorry I dont undertand
The only controller that calls the functions is the
AtController
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
This is exactly what I was going to talk with you about XD
Btw, I will send you something in the DMs
The answer is no, I can't change that unfortunately
Because a lot of code is already using the things like that elsewhere
It would be very costly to scan thru all and change
The version is related to the clients version
I must support older versions, I can't change that part, and the version comes in the URL, so not sure if I can use the think you mentioned about ASP.NET being able to manage that
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
No problem!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I can't change the website/API/controller/whatever/idk part
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Is something like this
endpoint/v2
or endpoint/v3
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
it was waht i was told
one of the methods that use the version stuff gets it like this
I see what you mean ask the guy again
Okay so the service is getting in the query string
not in the fortmat I showed above
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
why?
I alreaddy have a bunch Xd
i created some to experiment a bit
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ohh
XD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yep i idnt think about that XD
but
we will make code fromm scratch there?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see
Are you sure?
Im going to create a public repo in github
1 sec
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
so the issue is
i have a work git
and a personal git
and the computer uses the work git
it came set up
I can do that when I get home tho
in my personal computer
becasue
I have no clue how to chenge github accounts locally
im scared to break everything else XD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I have the repo
I created in the browser
but its empty
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
or that yeah
I asked chatgpt
XD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
and it wont change the global config, right=?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
so your comand is fine
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yes
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I seee
Ill try
1 sec
the command you made
created me a directory
with the name
user.email=whateveremailIused
XD
oph wait im dumb
I forgot a -c
lets ignore this 4 messages
IT WORKED
this is so cool!!
i wanted to do this is a long time but I was scared id mess up
I will do the dotnet things now?
creat a new project etcUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
same error
same error
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
vbut i did them
yes
sorry meanwhile i was trying to see how I can serialize and vice versa from XML
xd
cause one place is returning a xml and the way the service deals with it is kinda ugly? idk
trying to make it prettier
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So a different route to different versions?
Interesting
Woulndt that repeat alot of code?
because few things change
Or is there a way to put only the thing that change inside the folders
and then lets it handle that
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see
I will try to get the github thing working when I get home
work computer is being weird
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So the
ConsoleApp
project will make a HttpClient
, and that Client will make a request to the other project?
The LearnApiVErsiojn one?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see ok
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
You guessed correctly! :))
Wait
cant we usee Postman for this?
btw
I did this on my own:
Is this a noob thing?
I basically figured out the XML body of the reply i get
So I make a class for it
so that I can just deserialize into a object
and avoid weird parsing things
that the original code was doing
is this a bad idea?
i did some testing and with dummy data its working fine! :D
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oke
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
O
xd
my only scary though is
if the XML changes
buuuuut
it it would change there would be also problems with the orinial code
so i think its ok?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Ohhhh didn't think about that!!
Yeah it's starting to make a lot of sense
Well maybe for this no
But like overall
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Out of curiosity, why do they add that annotation?
https://learn.microsoft.com/en-us/aspnet/web-api/overview/data/using-web-api-with-entity-framework/part-5
I was looking thru this
and they add the annotation
[ResponseType(typeof(BookDetailDto))]
in the Get
method
What does that do?
Isnt the return type enoughf?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Okay im home im in a mac computer but i think since projects are cross platfor its fine
ill try the git repo now
Ok everything when finee
:D
https://github.com/juliodryfish/ASP.NET-C-Web-Service.git
i can then just clone this is work computer
and it will be fine i think
tebeco#0205
Quoted by
<@!689473681302224947> from #Understanding project structure - Visual Studio ASP.NET Core (click here)
React with ❌ to remove this embed.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Good morning
So I'm having a weird issue
I redid a part of the code
And it's not returning a JSON when I go to the endpoint
The object has the correct values in memory
But I might have messed up somewhere
This is what I did
This is what I do
result
is a CodigoPostalDTO
I always get a {}
in the response
even if the object has values in the fields
I have the NuGet packege
System.Text.Json
the method looks like this:
Its returning a IActionResult
Anything I can try?
O right I forget about thatI'm guessing you need to specify properties rather than fields. I don't think fields can be serialized.
You also don't need
JsonPropertyName
because the JSON is serialized as pascal case by default.I will try that in a moment, thank you!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
That was it!
thank you, i didntk know it was becasue of the get set thingy missing
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
im currently not using the newton json thingy
I change to the System.Text.Json
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
No its the one im making
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Im currently trying to clean a part of another code that
i think it can be better
They have this object
That they use all thru the project
I dont know enought to tell if its okay to have this or if there are microsoft stuff for this
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
xdd
the scary part is
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I posted the whole
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Well
They use it
as a JSON result
but with extra fields?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah lemme see if i can find a small one
it loadede btw
this is going to be a pain to clean
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
it did, just after a while it showed 500 xd
idk
Might I suggest to modify the public fields of the JsonResponse into properties, to easily see whether they are even used
goddamn it every method is so goddamn huge
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Question is why
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Found one
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
most likely
I completly removedf the previous DAO stuff
Since they were useless
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
STJ meaning... :p
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ohh ok
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
:(
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
they told me
the code was never reviewed
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
XD
So is using it as is, will be bad for future?
in not sure if the way it was made is bad or if the logic behind + the way it was made is bad
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh thats bad...
its not i think
I will get someplace where its used
so you can see
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Its only used
for UnitTesting
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Nope, never used
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
correct xd
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Xd
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
will do!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Btw
I should have mentioned this
the code 'im cleaning
is inside
AppBase
AppBase
is the base class for Apps
(whatever that means)
So looking at the structureUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
The thing in red
They told me
That the controllers use the functions thata are here
so the Controllers have the endpoints
and the things in red have extra code
the
AppBase.cs
have 4 classes insideSo this is a thing...
of these 4 classes
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
only
AppBase
is used for inheritageUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh
right
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
The changes im making are in the test project
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oke
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
bad?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oke
SO I make another class just for the
ToJson
?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
well
im having a issue
JObject
is from the Newton thiingy
but Im nto using that anymore
im using the System.Text.JsonUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
Oh
You just care to see if it compiles correctly?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ok
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh wait
i think i know the issue
it was the
;
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Oh
my bad
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I think so
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i cant run the tests
because
it will try to connect to production database
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
corect
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I do that on the original?
or now i move to my version?
Because
my version is not using Newton
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
good i think
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yep
i figured
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
A bunch is used like this
lemme see if i can find a small one
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
xd tell me i wanan laugh too
Xd
is bad?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
goddamn it
the more i find out about this code the more I regret XD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yes
but you will cringe
they look the same
cause they are the same
but they come from different files
same code
in the body of the function
but in differernt files
idk man
they did the virtual thing
but they used the same code
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
its only called with either null or JArray
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
fck no XD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
O
right
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
the first one is from the atrocious
BaseController.cs
, the second one inherits from the base controlelrUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
maybe some methods dont write to data
idk
ill try to find out
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oboy
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I will do that
o7
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
not yet one moment
i am drinking iogurt
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i see
ok, good luck!
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Sorry i've been away
Yesterday I pulled a wisdom tooth out
not been having a good time, can't really eat anything that isnt cold soup
or stare at the computer without feeling a bit sick
:(
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
4208 messages
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
what is the highscore?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
4211, I'd like to be part of this piece of history
so this is the thread with the highest amount of messages ever on this server.. wow
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Why the hell does this help thread have so many responses
Are you guys solving p np in here
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Oh lord
@TeBeConsulting might I suggest a different approach?
I think I have a more sane solution to changin all that
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Change all memebrs to private of the
JsonResponse
class
and got to each error
and comment
and some other thing
in the ToJosn thingy
call ctor with values and not new and then fill values
i think that was it
make the construction in the return statement
My idea is
first, rewrite this so that it uses System.Text.Json and now the NewtonJson thingy
and theeeen
as I split the things
correct the small diferences
Because
Changing in the whole thing at once its insane
I would be 100% lost all the time because I dont know the code that well
right now I alreaddy succesfully split 2 services
the one Im splitting and the next ones are the ones that use that JsonResult thing
so I think this is a good oportunity to fix it before splitting and when I split ill correct the code in the other places, no?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
well
in the original project yes
but im changing to sysmte.text.jsno
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah that is dones everywhere
we use a JsonResult
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Every JsonResult has something in the data
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Isnt there
something out there
that does this?
Cause I feel like they tried to reinvent some wheel
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I dont understand why it would impact the front end :(
maybe i dont undertstand the problem
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
well crap
why didnt they review the code that was going to be part of such a crucial part of the company
i swear to god
small panic
okay so
just so I understand
we are working with this crap, but what are the changes you suggest going to do?
make it less crap?
because i forgot
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
because I asked and I was told "you must keep the version support, because some customers have older versions or don't want to update to newer version"
I would assume the customer
i think? I donno :(
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Well
both I think
because we are changing
Usually
client has the program in Delphi
and that program talks with us
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
us being the service and stuff
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
but now
they are doing like stuff in browser
that in the future will replace the desktop
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
no
that will stay
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
fuck do I know man I just do that they tell me to do XD
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
there is a Rest made in Delphi
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
and there is the client made in Delphi
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
you mena, does the delphi client talk with this service?
sorry i get confused with words sometimes
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
good question
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I will ask
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
TS meaning...
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Well
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
That would be good, thing is
I dont run the company
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
The people that do, they want to keep having support for all kinds of clients
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
:(
I dunno man
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I'm just a junior developer
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I agree with what you say but I have no power herer
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I ask the guys before me
"What interacts with the service"
"the delphi cliente or only the cloud"
he replyed "it doesnt matter"
so either
he deosnt know or im not supposed to make assumptions to what will interact with the service
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yep
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Delphi client is still maintained
and will keep being maintained
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
the more we dig the more I space out
plus the mouth pain from the teeth are getting so annyoign
ughhhhhhhhh
im sad about this
feeling lost
i might just use the old thing that is done
too much has been build on top of it to change
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I could only do that once I got the thing working
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
well
the links care about version
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
okay only one thing I dont understand
well
I kinda understand
but I want to make sure
you are tellimg me to do a bunch of differnet kinds of Ctors because you want to make the properties private, and instead of creating a empty instance at the beginning of the function and slowly filling it up, you want to directly return a instance in the return statement
is that it?
and this is somehow better? This is the part I dont 100% understand, is encapsulation the only factor?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see
Makes sense now :)
Thank you for explaining again
they would remaing public then?
Imma do that
Ill start slow
Ill start with the current one Im splitting
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
its the smalles of them all that uses that
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I dont wanna touch the big one for this :(
isnt it better to do it while I split them?
same amount of work just done in different times
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
the original
the big service
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I guess
yeah
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
DI meaning
dependency injection?
Kek?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
now its 4500
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.Wowee this thread finally finished
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So
I'm having a big problem
Goddamn it I need to show code but can't rn I'm being monitored
In 1 hour and 40 minuts more or less I will put the code
Basically
The old code was using some old stuff that don't exist anymore
HttpContext.Request.Query.GetValue()
This took in a String key and String valueIfKeyNotFound
And returned the value for the key or second parameter
Since this does not exist, I found something similar
HttpContext.Rewuest.Query.TryGetValue() that takes in a Key and a reference to the place were it will store the result or the default value for the type of not found
But I'm getting the compiler mad and I'm not sure what to do
Well
I did something that I think worked lol but it's kinda cursed
I'll show code in a bit
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Xd
Hello
Can you confirm is something makes sense or is insane before I talk about the thing above?
I just found out that a Sha1 key was stored in the Resources
Is this dumb? Aren't the resources meant for like files n stuff?
Images or whatever
Also, won't this break cross platform?
Original service uses the Resources to store a Sha1 secret
Is this normal?
Then they have to have a Resources.Designer class thing to query the secret
I'm a nood but I think this is kinda insane
Please correct me :(
Maybe it's not insane
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
why this have 4544 (now 4545) messages
So the HttpContext contains the things I pass to the service?
Like the parameters in the url for example?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Hmmm I see
I'm having a JSON problem
If success and a object has fields, it does everything correct
If it has null, instead for getting a {} I get 204 No Content
I have no clue why, any tips I can try?
It used to return {}
I don't know what changed
Oh snap in the afternoon I'm going to a meeting to talk about what I did so far
Kinda hyped kinda nervous
I just hope I don't forget anything xd
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I see
Noted!
I think having JSON problems will be my day to day
I'm having the most weird problem
Sicne yesterday
I managed to get the original service running thankfully
I'm testing out one endpoint
Same code
Basically the only thing that changed was .NET version and the
JsonResult
object changed a bit
The original Service correctly fills the JsonResponse
object and returns the correct Json
My Service apparently correctly fills the JsonResponse
object but then when I go to return i get {}
If I try to force it to convert to JSON by calling the .ToJson
thingy, I get the most cursed JSON ever
Lemme get some prints to show 1 secThis is the normal return of the Object (it should get implicit converted to JSON)
This is me forcing the conversion to JSON by calling .ToJson
This is the contents of the object in memory, at the moment of the
return
So it has the things inside
The object in the service has the same contents
the memory looks the same
but this one shows nothing or trash and the original shows the correct thing :(
Any tips on how to aproach this? I got nowere yesterdayWas this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.not solved, still issues :L
😦
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
For clarity, the
Microsoft.AspNetCore.Mvc.Versioning*
are effectively EOL. Since the 6.0 and .NET 6+ release, you should now use Asp.Versioning.*
packages. Most things look, feel, and are named the same.
If you're going to organize by folder, you might find it more convenient to use a convention rather than attributes. For example:
Assuming the full type name was My.Api.Controllers.V1.FooController
, the version 1.0
would be applied without using any attributes. Conventions are not mutually exclusive and can be combined with other conventions, attributes. etc.Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.Nope! I solved it actually
I've been away from discord but i've made a lot of progress so far! I got every service split now, aaaaand i added docker support to the projects
So now I'm focusing on the Docker / Kubernetes aspect
I do have a bunch of questions but I think I will make a new thread for them, since they arent much on topic of this original thread idk
Oh god 4615 messages here already
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Keep it in this thread and make it even bigger
True!!
Youve started this, now youve got to commit
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Exactly one relation requires third table afaik - m to n (many to many).
To create that relationship we need helper table that has 1 to n (one to many) with both the tables that have have m to n
not only
a kinda of 1 to 1 can required 3 tables aswell
and some other cases that requires another table exist too
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
in what other cases? also ellaborate on that 1 to 1 case that requires 3 tables pls
1 to 1 non mandatory on each side requires 3 tables
other cases depends on the kinds of columns in the tables
I think those cases would be against 3NF rules
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Ah yes im not focusing i was just anwsering the questions
xd
The table I created was very basic
no relations
not relly
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.damn still not solved
Damn
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.