我與統一註冊一個實例是這樣的:廣東話決心實例
ContentSlideControlsEntity contentSlideControlsEntity = new ContentSlideControlsEntity(new Queue<uint>());
container.RegisterInstance(typeof(ContentSlideControlsEntity), "contentSlideControlsEntity", contentSlideControlsEntity);
然後,我只是想reslove它:
ContentSlideControlsEntity contentSlideControlsEntity2 = container.Resolve<ContentSlideControlsEntity>();
,但我得到以下運行時錯誤:
Microsoft.Practices.Unity.ResolutionFailedException: 'Resolution of the dependency failed, type = "MSDataLayer.Entities.ContentSlideControlsEntity", name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type Queue`1 has multiple constructors of length 1. Unable to disambiguate.
At the time of the exception, the container was:
Resolving MSDataLayer.Entities.ContentSlideControlsEntity,(none)
Resolving parameter "slideIDQueue" of constructor MSDataLayer.Entities.ContentSlideControlsEntity(System.Collections.Generic.Queue`1[[System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] slideIDQueue)
Resolving System.Collections.Generic.Queue`1[System.UInt32],(none)