Configuration Issues for IOC Unity

Source: Internet
Author: User

Recently watching the IOC, see unity This implementation framework, looking as if it is easy to use, write a demo of their own to try, did not think of the seemingly simple use, but also can encounter big problems, engaged in the majority of genius to solve the problem.

The Unity configuration of the demo is as follows:

 <configsections>    < Sectionname= "Unity"type= "Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration " />  </configsections>  <Unity>    <Containers>      <Containername= "Defaultcontainer">        <Registertype= "Ninjectconsole.interface.ia,ninjectconsole"Mapto= "ninjectconsole.attcak.a, ninjectconsole" />        <Registertype= "Ninjectconsole.interface.ib,ninjectconsole"Mapto= "ninjectconsole.attcak.b, ninjectconsole" />        <Registertype= "Ninjectconsole.interface.ic,ninjectconsole"Mapto= "ninjectconsole.attcak.c, ninjectconsole" />             </Container>    </Containers>  </Unity>

The implementation is as follows:

New="defaultcontainer");
as A

Implementation of this, the internet is everywhere, but I used to always have problems.

The VS issue is as follows:

After the reference has been cleared, what are the hidden dependencies? Or is there a problem with the configuration file? Degree Niang found some similar problem, said is the configuration problem, first change the configuration, see can solve.

There are those things that say configsections->section in the type to be added to the version, the public key, modified as follows:

 <  configsections  >  <  section  Span style= "COLOR: #ff0000" >name  = "Unity"   Type  = "Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, microsoft.practices.unity.configuration,version=5.1.2.0, Culture=neutral, publickeytoken=6d32ff45e0ccc69f "  />  </ configsections  >  

However, there is no use, or the same error, the use of this section when the error. Microsoft.Practices.Unity.Configuration This is really strange, is in the Unity.configuration this DLL, the program has a reference, but still reported this error. Looking for a long, and did not find related issues, think is not a version of the problem, because with the latest version of the version, in the NuGet to update unity to 4.0.1 This version, found that Microsoft.Practices.Unity this DLL has, no hidden. The reference part was re-modified, run, and finally passed.

The Class A is injected through unity-aware configuration.

The demo is up and running, But to Unity5.0 and above will put Microsoft.Practices.Unity.Configuration this class in unity.configuration this DLL, so there is no way to use, find the relevant solution, there is a solution to this problem, Daniel, also Please let me know and thank you very much.

Configuration Issues for IOC Unity

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.