English 中文(简体)
允许在卡斯温莎通过工厂方法进行选择性(核心)财产注入?
原标题:Allow optional (null) property injection in Castle Windsor via factory method?

I ve 登记了部件

container.Register(Component.For<XType>()
 .LifeStyle.Is(LifestyleType.Transient)
 .UsingFactoryMethod(SomeMethod));

并且目前正在利用这一手段在我的住房伙伴中注入财产。 NET MVC控制器。 然而,我目前的问题是,一些Method有时会回落无效。 堡垒对此并不感到太快乐,并抱怨说这是一个无效的例子。

难道要让温莎人听起来,使这一部分失去作用,是没有道理的? 我先是探讨一下,但已经找到了办法。

感谢。

最佳回答

没有任何东西可以通过温莎而告无效。

如果该构成部分无效,显然不能使用,那么,如果有可能的话,那将是毫无意义的。

如果你只把这一组成部分作为其他部分的财产来重新使用,我认为最好把这一组成部分作为动态的Para计。 那么,如果失败,那么温莎只会忽视它。

问题回答

暂无回答




相关问题
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. ...

热门标签