예제 #1
0
 public static T GetSingelService <T>(this IServicePool source, [Required] IServiceMetadata metadata)
     where T : class, IService
 {
     return(source.GetFirstOrDefault <T>(
                m =>
                m.Metadata.Contracts == metadata.Contracts && m.Metadata.Descriptor == metadata.Descriptor &&
                m.Metadata.ToString() == metadata.ToString()));
 }
예제 #2
0
 private static T GetSingelDefauldService <T>(this IServicePool source) where T : class, IService
 {
     return(source.GetFirstOrDefault <T>(m => m.Metadata.Contracts.Any(f => f == typeof(T))));
 }
예제 #3
0
 public static T GetSingelService <T>(this IServicePool source, string descriptor) where T : class, IService
 {
     return
         (source.GetFirstOrDefault <T>(
              m => m.Metadata.Contracts.Any(f => f == typeof(T)) && m.Metadata.Descriptor == descriptor));
 }