I am struggling to solve a problem and would really appreciate some help.
public interface ISolver<T>
{
void Solve();
}
public class Solver : ISolve<IEntity>
{
void Solve()
{
...code that solves the given problem
}
}
public class Client : IClient<IEntity>
{
public Dictionary<string, ISolver<IEntity>> Solvers { get; set; }
}
All are part of namespace solution.
In Spring.Net configuration:
<object id="Client" type="solution.Client, solution">
<property name="Solvers">
<dictionary key-type="string" value-type="solution.Solver, solution">
<entry key="SolverMp" value-ref="SolverMp"></entry>
</dictionary>
</property>
</object>
<object id="SolverMp" type="solution.Solver, solution">
</object>
I get the exception:
Spring.Core.TypeMismatchException: Cannot convert property value of type [System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[solution.Solver, solution, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]] to required type [System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[solution.ISolver`1[[solution.IEntity, solution, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], solution, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]] for property 'Solvers'.
Solver : ISolver<IEntity>
at the top and that it's a typo – annonymously