static IEnumerable <Type> GetServiceInstanceTypesToRegister(this IServiceInstance @this) { var actualType = @this.GetType(); return(actualType .GetCustomAttributes(typeof(ServiceAttribute), false) .Select(x => ((ServiceAttribute)x).Type ?? actualType)); }