在ASP.NET MVC 5应用程序中,我有以下StructureMap配置:
cfg.For(typeof (IRequestHandler<,>)).DecorateAllWith(typeof (MediatorPipeline<,>));
http://structuremap.github.io/interception-and-decorators/
我现在正在使用ASP.NET Core ...
Autofac中是否有等效的DecorateAllWith等效配置?
答案 0 :(得分:2)
是的,你可以这样做:
builder.RegisterGenericDecorator(typeof(MediatorPipeline<,>),
typeof(IRequestHandler<,>), fromKey: "requestHandler");
然后:
let iStrEmbed = "<iframe src=\"https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2Ffacebook%2Fvideos%2F10153231379946729%2F&width=500&show_text=false&height=281&appId\" width=\"500\" height=\"281\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>"
webVW.allowsInlineMediaPlayback = true
webVW.mediaPlaybackRequiresUserAction = false
webVW.loadHTMLString(iStrEmbed, baseURL: nil);
您可以查看完整文档undefined behavior。