we using unity 2.1 in asp.net application.
we using following code in beginrequest of global.asax:
public iunitycontainer getcontainer() { enginecontainer container = new enginecontainer(_correl); container.registerinstance(correlation, _correl); foreach(dependencytypemap typemap in _typemaplist) { setupdi(container, typemap); } return container; } private void setupdi(enginecontainer engcontainer, dependencytypemap map) { foreach (var m in map.maps) { list<object> args = new list<object>(); args.add(engcontainer.correlationinfo); if (m.item3 != null && m.item3.count() > 0) { args.addrange(m.item3); } if (m.item4 != null && m.item4.count() > 0) { args.addrange(m.item4); } engcontainer.registertype(m.item1, m.item2, new injectionconstructor(args.toarray())); } if (map.isloggingenabled) { foreach (var type in map.typestointercept) { engcontainer.setupforinteception(type); } } }
issue: value being passed registerinstance session id. in 1 of scenario value being passed registerinstance user a's id. however, in controller user b's id. so, when unity creating controller instance, incorrect session id being supplied controller.
question: registerinstance thread safe? cause of problem facing
Comments
Post a Comment