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>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<RootNamespace />
</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>
public BundleConfigurationCollection Add(
[NotNull] string bundleName,
[CanBeNull] Action<BundleConfiguration> configureAction = null)
Action<BundleConfiguration>? configureAction = null)
{
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>
public bool TryAdd(
[NotNull] string bundleName,
[CanBeNull] Action<BundleConfiguration> configureAction = null,
Action<BundleConfiguration>? configureAction = null,
bool overrideIfExists = false)
{
Check.NotNull(bundleName, nameof(bundleName));
@ -78,7 +78,7 @@ public class BundleConfigurationCollection
return true;
}
private BundleConfiguration CreateBundle(string bundleName, Action<BundleConfiguration> configureAction)
private BundleConfiguration CreateBundle(string bundleName, Action<BundleConfiguration>? configureAction)
{
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)
{
_contributors.ReplaceOne(x => x.GetType() == sourceContributorType,
contributor => (IBundleContributor)Activator.CreateInstance(destContributorType));
contributor => (IBundleContributor)Activator.CreateInstance(destContributorType)!);
}
else
{
@ -131,7 +131,7 @@ public class BundleContributorCollection
try
{
_contributors.Add((IBundleContributor)Activator.CreateInstance(contributorType));
_contributors.Add((IBundleContributor)Activator.CreateInstance(contributorType)!);
}
catch (Exception ex)
{

Loading…
Cancel
Save