本文介绍了温莎城堡2.5重大变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以前在

component.ExtendedProperties( new { prop = someObject });

该方法不再可用,Property的构造函数标记为内部。

This method is no longer available and the constructor for Property is marked internal.

是否有针对v2.5的新方法?

Is there a new way of doing this for v2.5?

具体地说,我有一个自定义的ComponentActivator,它需要一些实例信息,网址为从首次注册到解决的时间。我一直将此信息存储在ExtendedProperties中,然后使用

Specifically, I have a custom ComponentActivator that needs some instance information at resolution time from the initial registration. I have been storing this information in the ExtendedProperties then retrieving it in the ComponentActivator constructor using

model.ExtendedProperties["prop"] as MyObjectType;


推荐答案

.NET版本从未更改过,所以我我假设您正在谈论Silverlight的版本。

This was never changed in .NET version, so I'm assuming you're talking about version for Silverlight.

此方法将返回2.5.1版,但是由于Silverlight运行时的限制性行为,您必须使程序集中的内部类型对 Castle.Core 可见。

This method will be back in version 2.5.1, however due to restrictive behavior of Silverlight runtime you will have to make internal types in your assembly visible to Castle.Core.

在所有版本中都可以使用的替代方法是:

Alternative way, that works across all versions is this:

component.ExtendedProperties( Property.ForKey("prop").Eq(someObject));

这篇关于温莎城堡2.5重大变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 15:58