Home > Net >  How to use the multithreaded access into object AutofacMVC5.0 program
How to use the multithreaded access into object AutofacMVC5.0 program

Time:11-08

How to use the multithreaded access into object AutofacMVC5.0 program?

Project operation, will increase after the deletion of a table by creating a new thread to visit Autofac injected object, to manipulate the other data, but is because I use..net MVC 5.0 (not netCore MVC), for the life cycle of a class of MVC registration are InstancePerRequest () to specify each request a cycle, it encountered a problem, do not jump when the new thread starts, is already out of InstancePerRequest () the specified period, will lead to the container. The Resolve (CLS) go wrong, "unable to parse
"

to ask you, have any good idea or a solution?


This is a registered type picture


This error is called the picture

CodePudding user response:

Write a service class, registered with the Autofac, CLS injection to the service class, and combine the service class into your page, write a method in the service class, in this way to start a task,

CodePudding user response:

That's what I do,

CodePudding user response:

Write a class directly, instantiation is finished, why injection?

CodePudding user response:

reference JHDXHJ reply: 3/f
directly write a class, instantiate the just a matter of, why injection?


Many programmers have the discipline, the specification, the decompiled check, reverse engineering interface, the pursuit of universal, the pursuit of "demon" the impulse of the code,

Flexible extension is the pursuit of goals, but once too and can't get by on spectrum compiling check for errors, there is no guarantee that release products won't appear type errors at run time, always there is no guarantee that immediately solve the bug, so this kind of injection system 90% are very harmful,

CodePudding user response:

And commonly used function invoked repeatedly can see into one hundred times lower operation efficiency, and without different framework under the condition of high concurrent user performance testing,

CodePudding user response:

This class to register in the program?

CodePudding user response:

Has been registered

CodePudding user response:

reference 1st floor icoolno1 response:
write a first class service, registered with the Autofac, CLS injection to the service class, and combine the service class into your page, write a method in the service class, in this way to start a task,


The way I USES a batch register

CodePudding user response:

reference JHDXHJ reply: 3/f
directly write a class, instantiate the just a matter of, why injection?


Technology taste a fresh delicacy,,, ha ha ha ha

CodePudding user response:

For reflection, is always has to relief, use less as far as possible the principle of, also want to see the project case, the performance requirement is not high, can be used, or careful with, the company is a local tyrants can use (server obviously better than the general, don't care about more than a few servers), no matter what language reflection would reduce performance, even some of the new language, like go, the reflection of the performance is poor too outrageous, hundreds of times is to reduce the performance,

CodePudding user response:

refer to fifth floor interacting in a professional developer response:
and commonly used function invoked repeatedly can see into one hundred times lower operation efficiency, and without different framework under the condition of high concurrent user performance testing,

Brother, not all systems are go high concurrency,,, there are a lot of network operation system,,,

references to the tenth floor ying1234 response:
for reflection, is always has to relief, use less as far as possible the principle, also want to see the project case, the performance requirement is not high, can be used, or careful with, the company is a local tyrants can use (server obviously better than the general, don't care about more than a few servers), no matter what language reflection would reduce performance, even some of the new language, like go, the reflection of the performance is poor too outrageous, hundreds of times is to reduce the performance,


Reflection with less, but I am a technology to try, thank you ~

CodePudding user response:

reference 4 floor interacting in a professional developer response:
Quote: refer to the third floor JHDXHJ response:
directly write a class, instantiate the just a matter of, why injection?


Many programmers have the discipline, the specification, the decompiled check, reverse engineering interface, the pursuit of universal, the pursuit of "demon" the impulse of the code,

Flexible extension is the pursuit of goals, but once too and can't get by on spectrum compiling check for errors, there is no guarantee that release products won't appear type errors at run time, always there is no guarantee that immediately solve the bug, so this kind of injection system 90% are very harmful,


Yes, what you said is right, is objective, for the products, high stability, high reliability, high security is the priority target, but I am a technology to try, thank you for your advice,
  • Related