Beyond Dependency Injection: Listing 3.

Selecting the right IDataFeed.

class DataFeedHandlerSelector : IHandlerSelector
{
  private bool networkAvailable;
 
  public DataFeedHandlerSelector()
  {
    // Hook in to network monitoring component
    // to set networkAvailable flag.
   }
 
  public bool HasOpinionAbout(string key, Type service)
  {
  }
 
  public IHandler SelectHandler(string key,
    Type service,
    IHandler[] handlers)
  {
  }
}

About the Author

Patrick Steele is a senior .NET developer with Billhighway in Troy, Mich. A recognized expert on the Microsoft .NET Framework, he’s a former Microsoft MVP award winner and a presenter at conferences and user group meetings.

comments powered by Disqus

Featured

Subscribe on YouTube