SmartDIContainer.cs
/// <summary>
/// Looks for a valid registration as the "best choice" for the current conditions.
/// </summary>
/// <param name="typeRequestedT">The type requested t.</param>
/// <param name="registrations">The registrations.</param>
/// <param name="resolutionToSeek">The resolution to seek.</param>
/// <returns><c>true</c> if a valid registration is found, else <c>false</c>.</returns>
Looks for a valid registration as the "best choice" for the current conditions.
Looks for a valid registration as the " best choice " for the current conditions .
private bool CannotFindObviousChoice
      (
         Type                                                           typeRequestedT,
         ConcurrentDictionary<Type, ITimeStampedCreatorAndStorageRules> registrations,
         ref KeyValuePair<Type, IProvideCreatorAndStorageRule>          resolutionToSeek
      )
      {
         var foundDict = registrations.OrderBy(qr => qr.Value.WhenAdded).First().Value;
         var found     = false;
         foreach (var keyValuePair in foundDict.CreatorsAndStorageRules)
         {
            if (keyValuePair.Key == typeRequestedT)
            {
               resolutionToSeek = keyValuePair;
               found            = true;
               break;
            }
         }
         return !found;
      }
private bool CannotFindObviousChoice ( Type typeRequestedT , ConcurrentDictionary < Type , ITimeStampedCreatorAndStorageRules > registrations , ref KeyValuePair < Type , IProvideCreatorAndStorageRule > resolutionToSeek ) { var foundDict = registrations . OrderBy ( qr => qr . Value . WhenAdded ) . First ( ) . Value ; var found = false ; foreach ( var keyValuePair in foundDict . CreatorsAndStorageRules ) { if ( keyValuePair . Key == typeRequestedT ) { resolutionToSeek = keyValuePair ; found = true ; break ; } } return ! found ; }
Looks for a valid registration as the "best choice" for the current conditions.
Looks for a valid registration as the " best choice " for the current conditions .
// Sort by date/time added, then select // Should never fail based on previous checks -- we ensured that at least one entry existed
None
typeRequestedT
Type
The type requested t.
The type requested t .
registrations
ConcurrentDictionary<Type, ITimeStampedCreatorAndStorageRules>
None
KeyValuePair<Type, IProvideCreatorAndStorageRule>
ref
resolutionToSeek
The resolution to seek.
The resolution to seek .