How can I make Unity not to throw ResolutionFailedException if Resolve fails?
Is there something like TryResolve
This is not available in the current release. However, you can always "roll your own" using extension methods in C# 3. Once Unity supports this, you can omit or update the extension method.
public static class UnityExtensions
{
public static T TryResolve( this UnityContainer container )
where T : class
{
try
{
return (T)container.Resolve( typeof( T ) );
}
catch( Exception )
{
return null;
}
}
}