ApplicationDbContext Object [closed] - asp.net

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 4 years ago.
Improve this question
I'm ASP.Net MVC trainee.
and I use Entity Framework.
but I'm Tense for create an instance from ApplicationDbContext in every controller class.
And I think that will make a huge size in server memory, is what's happen is that the the asp move the database to memory? or just create an object with references?.
is create a static object of ApplicationDbContext will make things better?
And what's the ideal way to work with Entity Framwork?

Repository + Dependency Injection can be a good practice.
You can use a generic repository and inject your DbContext into that for only once.

Related

How can i implementation a supporter chat with user (user to manager) in MVC5? [closed]

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 2 years ago.
Improve this question
I'm creating MVC5 app, and I'm already using ASP.NET Identity2.0 to create users. So, I already have the AspNetUsers table, How can i implement a chat connection between manager with a special user(not all users in a moment).
SignalR is something you are probably looking for. Read about it here. There is a lot of online examples how to implement it in MVC. It allows direct user to user connections.

Separate H2 database for JUnit in Servlets and JDBC [closed]

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 3 years ago.
Improve this question
I can`t find info how to set up separate H2 db for JUnit in servlets. All info about Spring, but i need H2 to test my DAO and controllers in Servlets app. Will be glad about any info.
The problem was solved with a bit weird way. In my AuthorService DAO class i created constructor which take a connection. And depends on the situation i inject right connetion with AbstractFactory.

Xamarin.Forms: Process URI Arguments When App is Called From Another App [closed]

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 2 years ago.
Improve this question
Xamarin Form's Device.OpenURI allows you to call an App and pass some arguments embedded within the URI. In turn, I am wondering whether there is a way for the called App to process this URI? I would prefer handling this processing only within the shared code. Any ideas?
I decided to register a URI scheme for my app (https://xamarinhelp.com/uri-scheme/)

Web Api vs MVC Controller [closed]

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.

Symfony inteface based constructor dependency injection [closed]

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.

Resources