How do I register a generic type in MVVMCross

Viewed 2034

I have an interface defined as follows:

public interface ISerializationStrategy<T>

and also a generic implementation:

    public class SerializationStrategy<T> : Core.Strategies.ISerializationStrategy<T>

When I register this in the IOC do I have to do the following for each type:

Mvx.RegisterType<ISerializationStrategy<IdentityProvider>,SerializationStrategy<IdentityProvider>>();
... each type

Or is there a way to register an open generic (I think thats what it's called). The following doesn't work:

Mvx.RegisterSingleton(typeof (ISerializationStrategy<>),typeof (SerializationStrategy<>));

Thanks

Ross

2 Answers
Related