I guess doing it in C# would mean it goes back to the server. So if it's a small calculation, the time it needs to travel back and forth might be longer than the time the calculation would need in JS.
Doing it in C# means it runs on the server, costing your server performance. Doing it in JS pushes it to the client browser, meaning no wasted performance, but possibly a lot slower.
Of course rendering on the server will cost you perofrmance, while rendering on the client will just push it to the client. So if you don't have too many users or like, a server farm at your disposal you can just do it all on the server no sweat.
@Squirrelkiller I am no computer expert and thought the opposite is true. --> (Server-Rendering is faster than client-rendering) - Any hint were I can read more about this topic?
Basically you could either do it like angular: Send a lot of javascript that then loads html templates and builds the whole stuff according to what the javascript says. Or like MVC: Make the templating/rendering on the server and then send (almost-) static html to the client.
Not necessarily; JS is very performant and building a SPA all but demands using it. And there are many upsides to a SPA. The UX of traditional request/response model cannot even compare to the UX of a good SPA. The downside? It's harder to write a good SPA.
Well it does, but lets say your data needs 150ms to get through the web - that's so fast, a user won't even notice it. Think about news sites that need like 20 seconds to actually load all the ads and articles and shit.
Decide on your model. Are you doing a traditional request/response model? Use C# for anything you can do without requiring JS. If you're doing a SPA, just use C# for your APIs and nothing else.
so, then I tried to just follow the examples of how to make Azure Functions with Java, but so far no infrastructure as code, so a microservice arch would be a pain
@Squirrelkiller it needs to support Java, .net core and node.js
@Wietlol I want to achieve the following. I have a supermarkt simulation. There is a supplier. And I as the supermarket manager can order products. I have some standard products. Then I need a form field after every product were I can type the amount of the product to order. when I change the amount I want a recalculation of the overall sum. (was this understandable?)
Then when you try injecting a scoped service into a singleton, the DI will crash telling you that you can't inject a non-singleton service into a singleton, for exactly that reason: You can't scope a service when you have a dependent singleton.
.AddSingleton<IService, Service>()
// later
var service = GetService<IService>() // first instance
// more later
.AddSingleton<IService>(...new Service(...)) // second instance