Browse Source

Enable nullable annotations for Volo.Abp.AspNetCore.Mvc.UI.Bunding.Absractions

pull/17094/head
liangshiwei 3 years ago
parent
commit
e56dfe0a6d
  1. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions.csproj
  2. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationCollection.cs
  3. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleContributorCollection.cs

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>

6
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationCollection.cs

@ -27,7 +27,7 @@ public class BundleConfigurationCollection
/// <returns>Returns this object for chained calls.</returns> /// <returns>Returns this object for chained calls.</returns>
public BundleConfigurationCollection Add( public BundleConfigurationCollection Add(
[NotNull] string bundleName, [NotNull] string bundleName,
[CanBeNull] Action<BundleConfiguration> configureAction = null) Action<BundleConfiguration>? configureAction = null)
{ {
if (!TryAdd(bundleName, configureAction)) if (!TryAdd(bundleName, configureAction))
{ {
@ -52,7 +52,7 @@ public class BundleConfigurationCollection
/// <returns>Returns true if added. Returns false if it's already added before.</returns> /// <returns>Returns true if added. Returns false if it's already added before.</returns>
public bool TryAdd( public bool TryAdd(
[NotNull] string bundleName, [NotNull] string bundleName,
[CanBeNull] Action<BundleConfiguration> configureAction = null, Action<BundleConfiguration>? configureAction = null,
bool overrideIfExists = false) bool overrideIfExists = false)
{ {
Check.NotNull(bundleName, nameof(bundleName)); Check.NotNull(bundleName, nameof(bundleName));
@ -78,7 +78,7 @@ public class BundleConfigurationCollection
return true; return true;
} }
private BundleConfiguration CreateBundle(string bundleName, Action<BundleConfiguration> configureAction) private BundleConfiguration CreateBundle(string bundleName, Action<BundleConfiguration>? configureAction)
{ {
var bundle = new BundleConfiguration(bundleName); var bundle = new BundleConfiguration(bundleName);

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleContributorCollection.cs

@ -54,7 +54,7 @@ public class BundleContributorCollection
if (!includeDependencies) if (!includeDependencies)
{ {
_contributors.ReplaceOne(x => x.GetType() == sourceContributorType, _contributors.ReplaceOne(x => x.GetType() == sourceContributorType,
contributor => (IBundleContributor)Activator.CreateInstance(destContributorType)); contributor => (IBundleContributor)Activator.CreateInstance(destContributorType)!);
} }
else else
{ {
@ -131,7 +131,7 @@ public class BundleContributorCollection
try try
{ {
_contributors.Add((IBundleContributor)Activator.CreateInstance(contributorType)); _contributors.Add((IBundleContributor)Activator.CreateInstance(contributorType)!);
} }
catch (Exception ex) catch (Exception ex)
{ {

Loading…
Cancel
Save