English 中文(简体)
通过团结拦截和注射例外政策设立例外处理申请区
原标题:Setup Exception Handling Application Block via Unity Interception and inject exception policies

I am trying to setup Exception Handling Block for my application and would like to inject exception handling policies (defined in configuration file) at the point where I am registering modules and interception with unity in my IoC factory.

现在,我只是登记各种类型,确定拦截和使用例外行为,例如:

container.AddNewExtension<Interception>();
container.RegisterType<INotificationService, NotificationService>(
     new TransientLifetimeManager(), new Interceptor<InterfaceInterceptor>(),
     new InterceptionBehavior<ExceptionBehavior>());

Then I am handling exception in the Invoke method of my exception behaviour and applying policies there like this:

exManager.HandleException(ex, policy);

Is this the right way and any ideas or feedback and how can I inject policies when I am setting up the unity container?

问题回答

您可在企业图书馆使用政策注射特征,并使用例外处理手:《





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签