Created
February 10, 2011 04:49
-
-
Save cammerman/819967 to your computer and use it in GitHub Desktop.
Cache registrations
This file contains 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
builder | |
.RegisterType<Cache>() | |
.Keyed<ECacheType>(ECacheType.Thumb) | |
.As<ICache>() | |
.InstancePerLifetimeScope(); | |
builder | |
.RegisterType<Cache>() | |
.Keyed<ECacheType>(ECacheType.Image) | |
.As<ICache>() | |
.InstancePerLifetimeScope(); |
This file contains 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
public class ImageBrowser | |
{ | |
public virtual ICache ThumbCache | |
{ | |
get; | |
private set; | |
} | |
public virtual ICache ImageCache | |
{ | |
get; | |
private set; | |
} | |
public ImageBrowser(ICache thumbCache, ICache imageCache) | |
{ | |
ThumbCache = thumbCache; | |
ImageCache = imageCache; | |
} | |
} |
This file contains 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
protected virtual void OnPreparingImageBrowser(PreparingEventArgs e) | |
{ | |
e.Parameters = new[] { | |
new NamedParameter( | |
"thumbCache", | |
e.Context | |
.ResolveKeyed<ICache>(ECacheType.Thumb)), | |
new NamedParameter( | |
"imageCache", | |
e.Context | |
.ResolveKeyed<ICache>(ECacheType.Image)) | |
}; | |
} |
This file contains 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
builder | |
.RegisterType<ImageBrowser>() | |
.OnPreparing(OnPreparingImageBrowser) | |
.AsSelf() | |
.InstancePerLifetimeScope(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment