예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <summary>
        /// Adds default application parts if no non-framework parts have been added.
        /// </summary>
        /// <param name="applicationPartsManager">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();
#if NETCOREAPP
                applicationPartsManager.AddFromAssemblyLoadContext();
#else
                applicationPartsManager.AddFromAppDomainWithReferences();
#endif
            }

            return(applicationPartsManager);
        }
예제 #3
0
 /// <summary>
 /// Adds all assemblies referencing Orleans found in the application's <see cref="DependencyContext"/>.
 /// </summary>
 /// <param name="manager">The builder.</param>
 /// <returns>The builder with the additionally included assemblies.</returns>
 public static IApplicationPartManagerWithAssemblies AddFromDependencyContext(this IApplicationPartManager manager)
 {
     return(manager.AddFromDependencyContext(Assembly.GetCallingAssembly())
            .AddFromDependencyContext(Assembly.GetEntryAssembly())
            .AddFromDependencyContext(Assembly.GetExecutingAssembly()));
 }