private static void AddDefaultApplicationParts(IApplicationPartManager applicationPartsManager) { var hasApplicationParts = applicationPartsManager.ApplicationParts.OfType <AssemblyPart>() .Any(part => !part.IsFrameworkAssembly); if (!hasApplicationParts) { applicationPartsManager.AddFromAppDomain(); applicationPartsManager.AddFromApplicationBaseDirectory(); } }
/// <summary> /// Adds default application parts if no non-framework parts have been added. /// </summary> /// <param name="applicationPartManager">The application part manager.</param> /// <returns>The application part manager.</returns> public static IApplicationPartManager ConfigureDefaults(this IApplicationPartManager applicationPartsManager) { var hasApplicationParts = applicationPartsManager.ApplicationParts.OfType <AssemblyPart>() .Any(part => !part.IsFrameworkAssembly); if (!hasApplicationParts) { applicationPartsManager.AddFromDependencyContext(); applicationPartsManager.AddFromAppDomain(); applicationPartsManager.AddFromApplicationBaseDirectory(); } return(applicationPartsManager); }