Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I believe there are several problems with the configuration you have posted:</p> <ol> <li>It appears you are trying to <a href="http://msdn.microsoft.com/en-us/library/ff660914%28v=pandp.20%29.aspx#config_instances" rel="nofollow">register an instance</a> rather than <a href="http://msdn.microsoft.com/en-us/library/ff660914%28v=pandp.20%29.aspx#config_registerelement" rel="nofollow">register a type mapping</a>. To do this you need to use the <strong>instance</strong> element rather than the <strong>register</strong> element.</li> <li><p>The syntax you are using to specify a generic type is not correct. To specify a <strong>Dictionary&lt;string, int&gt;</strong> the proper syntax should be:</p> <p>type="System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.Int32, mscorlib]], mscorlib"</p></li> </ol> <p>Note the `2 designates the generic type as having two type parameters.</p> <ol> <li><a href="http://msdn.microsoft.com/en-us/library/ff660914%28v=pandp.20%29.aspx#config_instances" rel="nofollow">Specifying a value for your instance</a> is achieved by setting the <strong>value</strong> attribute. This is a string value that must somehow be converted into a series of key value pairs for your dictionary. This will not happen by default unfortunately. You will need to write a custom converter which will accept a string and create your key/value pairs. An example of such a converter can be found <a href="http://unity.codeplex.com/discussions/230927?ProjectName=unity" rel="nofollow">here</a>.</li> </ol> <p>As a final note (and a personal preference), I'm really not a fan of using Unity for this type of object creation. I generally use a custom configuration file for any non-trivial initialization settings and use Unity strictly to register type mappings for dependency injection.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload