Browse Source

throw exception if a module contains multiple bundle contributors.

pull/6281/head
Ilkay Ilknur 6 years ago
parent
commit
ef8646f4ba
  1. 13
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs

13
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs

@ -180,12 +180,19 @@ namespace Volo.Abp.Cli.Bundling
int level,
List<BundleTypeDefinition> bundleDefinitions)
{
var bundleContributer = module.Assembly
var bundleContributers = module.Assembly
.GetTypes()
.SingleOrDefault(t => t.IsAssignableTo<IBundleContributer>());
.Where(t => t.IsAssignableTo<IBundleContributor>())
.ToList();
if (bundleContributer != null)
if (bundleContributers.Count > 1)
{
throw new BundlingException($"Each project must contain only one class implementing {nameof(IBundleContributor)}");
}
if (bundleContributers.Any())
{
var bundleContributer = bundleContributers[0];
var definition = bundleDefinitions.SingleOrDefault(t => t.BundleContributerType == bundleContributer);
if (definition != null)
{

Loading…
Cancel
Save