Created
January 8, 2010 14:59
-
-
Save jfromaniello/272091 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using Castle.MicroKernel.Registration; | |
using Castle.MicroKernel.Resolvers; | |
namespace CompositeWPFContrib.Composite.WindsorExtensions | |
{ | |
public class LazyLoader : ILazyComponentLoader | |
{ | |
private readonly string[] allowedAssembliesNames = new[] | |
{ | |
"Microsoft.Practices.Composite", | |
"Microsoft.Practices.Composite.Presentation", | |
"Microsoft.Practices.Composite.Wpf" | |
}; | |
#region ILazyComponentLoader Members | |
public IRegistration Load(string key, Type service) | |
{ | |
if (allowedAssembliesNames.Any(n => service.Assembly.FullName.StartsWith(n))) | |
{ | |
return Component.For(service).Named(key).LifeStyle.Transient; | |
} | |
return null; | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment