Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/22/12 12:05:20 (13 years ago)
Author:
svonolfe
Message:

Added support for derived data types (#1782)

Location:
trunk/sources/HeuristicLab.Problems.Instances/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Instances/3.3/IProblemInstanceConsumer.cs

    r7683 r7867  
    2525  public interface IProblemInstanceConsumer : IContent { }
    2626
    27   public interface IProblemInstanceConsumer<TData> : IProblemInstanceConsumer {
     27  public interface IProblemInstanceConsumer<in TData> : IProblemInstanceConsumer {
    2828    /// <summary>
    2929    /// Loads the given instance data.
  • trunk/sources/HeuristicLab.Problems.Instances/3.3/ProblemInstanceManager.cs

    r7846 r7867  
    3636          .Select(x => typeof(IProblemInstanceProvider<>).MakeGenericType(x));
    3737
     38        if (instanceTypes.Any(x => x.GetGenericArguments().First().IsInterface)) {
     39          var interfaceTypes = instanceTypes.Where(x => x.GetGenericArguments().First().IsInterface)
     40            .SelectMany(x => ApplicationManager.Manager.GetTypes(x.GetGenericArguments().First()));
     41
     42          if (interfaceTypes.Any())
     43            instanceTypes = instanceTypes.Union(interfaceTypes.Select(x => typeof(IProblemInstanceProvider<>).MakeGenericType(x))).Distinct();
     44        }
     45
    3846        foreach (var type in instanceTypes) {
    3947          foreach (var provider in ApplicationManager.Manager.GetInstances(type))
Note: See TracChangeset for help on using the changeset viewer.