private static IEnumerable <Models.Service> GetDiscoveratedServices(Assembly assembly) { IEnumerable <TypeInfo> types; try { types = assembly.DefinedTypes; } catch (ReflectionTypeLoadException) { //couldn't load this assembly - probably a non-issue yield break; } foreach (TypeInfo ti in types) { SwaggeratedAttribute da = ti.GetCustomAttribute <SwaggeratedAttribute>(); if (da != null) { DescriptionAttribute descAttr = ti.GetCustomAttribute <DescriptionAttribute>(); Models.Service service = new Models.Service { path = da.LocalPath, description = (descAttr == null) ? da.Description : descAttr.Description }; yield return(service); } } }
private static IEnumerable<Models.Service> GetDiscoveratedServices(Assembly assembly) { IEnumerable<TypeInfo> types; try { types = assembly.DefinedTypes; } catch (ReflectionTypeLoadException) { //couldn't load this assembly - probably a non-issue yield break; } foreach (TypeInfo ti in types) { SwaggeratedAttribute da = ti.GetCustomAttribute<SwaggeratedAttribute>(); if (da != null) { DescriptionAttribute descAttr = ti.GetCustomAttribute<DescriptionAttribute>(); Models.Service service = new Models.Service { path = da.LocalPath, description = (descAttr == null) ? da.Description : descAttr.Description }; yield return service; } } }