Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is order of dependencies guaranteed when injecting IEnumerable<T>

I register in container services implementing IMyService.

Do I have any guarantees about their order in

container.Resolve<IEnumerable<IMyService>>

?

like image 715
Konstantin Spirin Avatar asked Mar 07 '11 10:03

Konstantin Spirin


1 Answers

I don't mean to self-promote, but I have also created a package to solve this problem because I had a similar need: https://github.com/mthamil/Autofac.Extras.Ordering

It uses the IOrderedEnumerable<T> interface to declare the need for ordering.

like image 177
Matt H Avatar answered Oct 04 '22 03:10

Matt H