3
我有以下的一般壽命經理與一般壽命管理工作,團結配置部分
public class RequestLifetimeManager<T> : LifetimeManager, IDisposable
{
public override object GetValue()
{
return HttpContext.Current.Items[typeof(T).AssemblyQualifiedName];
}
public override void RemoveValue()
{
HttpContext.Current.Items.Remove(typeof(T).AssemblyQualifiedName);
}
public override void SetValue(object newValue)
{
HttpContext.Current.Items[typeof(T).AssemblyQualifiedName] = newValue;
}
public void Dispose()
{
RemoveValue();
}
}
如何在統一配置部分引用此。創建一個類型別名
<typeAlias alias="requestLifeTimeManager`1" type=" UI.Common.Unity.RequestLifetimeManager`1, UI.Common" />
並指定其作爲一生的經理
<types>
<type type="[interface]" mapTo="[concretetype]" >
<lifetime type="requestLifeTimeManager`1" />
</type>
</types>
導致以下錯誤
Cannot create an instance of UI.Common.Unity.RequestLifetimeManager`1[T] because Type.ContainsGenericParameters is true.
你如何引用泛型一輩子經理人?