jestem konwersji aplikacji Zamek/kolejek w jedno/Asp.NET MVC jeden, Utknąłem w próby przekształcania tej konfiguracji komponent:Unity: Zbuduj słownika
<component
id="ComponentBaseConfiguration"
service="MyFakeNamespace.BOL.IConfiguration, MyFakeAppDll"
type="MyFakeNamespace.BOL.ConfigurableConfiguration, MyFakeAppDll">
<parameters>
<!-- Setting Configuration (Dictionary<string,string>)-->
<Config>
<dictionary>
<entry key="localHost">#{LocalHost}</entry>
<entry key="contentHost">#{ContentHost}</entry>
<entry key="virtualDir">#{VirtualDir}</entry>
</dictionary>
</Config>
</parameters>
wydaje się, że Unity obsługuje Array ale nie słownik, chciałbym zrobić coś takiego:
<unity>
<containers>
<container>
<types>
<type name="ComponentBaseConfiguration" type="MyFakeNamespace.BOL.IConfiguration, MyFakeAppDll" mapTo="MyFakeNamespace.BOL.ConfigurableConfiguration, MyFakeAppDll">
<typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement, Microsoft.Practices.Unity.Configuration">
<property name="Config" propertyType="System.Collections.Generic.Dictionary`2[[System.String, mscorlib], [System.String, mscorlib]],mscorlib">
<dictionary>
<entry key="localHost">127.0.0.1</keyedValue>
<entry key="contentHost">\\content</keyedValue>
<entry key="virtualDir">/</keyedValue>
</dictionary>
</property>
</typeConfig>
</type>
</types>
</container>
</containers></unity>
Jak mogę osiągnąć coś takiego?
Mam coś takiego do pracy. zobacz - http://stackoverflow.com/questions/5597492/how-do-i-create-and-populate-a-dictionarystring-object-using-unitys-xml-confi/7901103#7901103 – ScArcher2
Oto moje rozwiązanie dla starszych wersja - wymaga pewnych zmian w kodzie - kiedy będę miał czas, może spróbuję to zaadaptować do nowej wersji Unity http://unity.codeplex.com/discussions/230927/ – AdaskoTheBeAsT