Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
We had a discussion at work where one of our employees was creating a Web Api controller specifically for one method that returns JSON data. While it works, I noted the fact that he didn't have to create a Web Api controller for this since the scope of that data is really only to be used in that application and not to be consumed elsewhere. I mentioned that he should have just put a JsonResult method in the already existing controller and that now we have two controllers to maintain instead of one. That's when the chairs went flying!!!
While I don't think my suggestion is wrong maybe it is. Am I wrong in my thought process.
It is an opinion based question, so take my answer with a grain of salt.
If this is all just for a single action method, my opinion is not worth to have a separate API Controller.
Why?
You need to register route for Web API.
You need to register Web API controller for Dependency Injection.
You need separate Exception Handler.
You need separate Filters for Web API.
1 and 2 are quite easy, but 4 is not if you have too many filters.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I am looking at using Go for my web server:
https://golang.org/doc/articles/wiki/
I was actually going for:
https://spring.io/
since it comes with tons of modules for a web server, like security, data, etc.
Would it make sense to use Go as the Web Server for handling traffic/request and have Spring behind for the actual building of the back-end/MVC?
Or would you typically needs to make a decision between either Go or Spring?
Would it make sense to use Go as the Web Server for handling traffic/request and have Spring behind for the actual building of the back-end/MVC?
No, I don't think so. It's better to take nginx and have Tomcat server with Spring application behind it.
Or would you typically needs to make a decision between either Go or Spring?
Yes, choose what's better for your current task. You can use Spring for the entire web application, Go for some parts, etc.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I Have a question regarding those 2 techniques, if I'm going to use both techniques in my project doesn't they clash?
for example, they both use the MVC model. So if I use the angular routing isn't the ASP.net MVC routing unnecesarry than?
Is it a smart move to only use ASP.net to create the WEB API and the other backend processing, and angularJS to implement MVC and talk to the API
any suggestions?
You shouldn't have to worry about them clashing if done correctly. Your bigger concern should be the additional and redundant work it may cause. For the large majority of situations, having Angular interact directly with WEB API is favorable because it eliminates a layer and makes your UI completely portable between technology stacks.
There are merits to the hybird approach though that are concisely expalined here: https://softwareengineering.stackexchange.com/questions/209735/mixing-angular-and-asp-net-mvc-web-api
The two can complement each other. MVC routing only kicks in when you make a server request. So long as no HTTP request to the server is made, then MVC routing doesn't kick in. I use the server for returning "dynamic content" that depends on some server resident information. You can fetch modals from the server as Partials. Using the Server for mostly API work is however advisable.
There is a project called TwitterBootStrapMVC (https://www.twitterbootstrapmvc.com/) That enables you to render pure bootstrap markup on the server and deliver it to angular after some "post processing". It is handy and works well with Angular.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I just got introduced to log4net and its abilities. For starters I'm currently working on a small project. We need to log errors,warnings etc to a file and also send an email to all developers involved about any Fatal errors. Is log4net an overkill for a small project thats got about 10 classes that require the logging functions? Are there any benefits of using log4net in the long run? We were initially going to just use FileIO manipulations and Mail functions to achieve the same.
The answer on this question is primarily opinion-based, some reasons to use a logging framework from the start:
Standard way of logging
Easy configuration
Small projects will grow, if you do it right from the start, there is no later rework needed
Using a logging framework will not cost you more time than writing your own. It will probably safe time. For example log4net will never crash your program when logging fails. Your own framework might interact with your business logic and gives you unexpected results.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I need to create my own application that is similar windows performance monitor. I want to monitor the DQL using asp.net. But i don't know where to start. I already research but no luck.
Consider using below components (but still remember, it is only a suggestion) to start from:
System.Diagnostics.PerformanceCounter class - to access performance counter data
ASP.NET MVC - to create a website
SignalR - to create a backend Hub for client notifications of data gathered by PerformanceCounter class
DotNet.Highcharts - to create charts control
What is your planned usage of this application? If you are planning to use it for your organization then you might want to consider SaaS solution that allows you to plug in your collector.
You have better uptime on the monitoring application because that monitoring service is the last thing you want to go down. You are probably more familiar with how to monitor DQL than to create an application that does charting and alerting. You should be able to get something going within days instead of weeks.
Monitoring is normally composed of collecting, storing and charting. A good SaaS monitoring tool will do well with storing and charting and you need to look for ones with plugin framework that allow you to decide what to collect.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm .NET developer and have some questions about Symfony's IoC implementation.
Does Symfony is capable for .NET-style (i.e. Ninject, Castle Windsor, etc.) constructor injections. Namely, can I avoid the necessity of giving name to each service and bind service implementation to interface instead? Also can I do not define each controller as a service for make DI working? "Controller as a service" and manual configuration constructor's parameters in services.yml(xml) seems to me redundant after years of .NET development. Thanks.
P.S. Sorry for my english.
Namely, can I avoid the necessity of giving name to each service and bind service implementation to interface instead?
No, you can't. It one of the things I'm missing in the di component too.
Also can I do not define each controller as a service for make DI working?
The good point about symfony2 is that it removed most of the convention-based things. Doing the thing you suggested adds a mew convention to symfony. You could check the KnpRadBundle, to see how they implemented auto registering of other services, based on conventions and create your own bundle which does it for controllers.