Exemplo n.º 1
0
        public static IAddInAppBuilder UseAddIns(this IAddInAppBuilder addInAppBuilder, string[] args)
        {
            addInAppBuilder.ConfigureFeature(features => {
                features
                .AddFeature <AddInsFeature>()
                .FeatureServices(services => {
                    services.AddSingleton <AddInService>();
                });
            });

            //load addins indicate as auto addins
            foreach (string name in AutoRegistration.PackagesByName)
            {
                AddInTypes addInTypes = TypeLoader.LoadAddInTypes(NamedAddins.DeploymentPackages[name]);

                addInAppBuilder.ConfigureFeature(features => {
                    features
                    .AddFeature(addInTypes.Feature)
                    .FeatureServices(services => {
                        services.AddSingleton(addInTypes.Interface, addInTypes.Service);
                    });
                });
            }
            return(addInAppBuilder);
        }