Browse Source

Change the nullable parameter of ExposeServices to a non-nullable type.

Resolve #2252
pull/2253/head
maliming 7 years ago
parent
commit
f12c33ad62
  1. 10
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposeServicesAttribute.cs
  2. 3
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposedServiceExplorer.cs

10
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposeServicesAttribute.cs

@ -9,9 +9,9 @@ namespace Volo.Abp.DependencyInjection
{
public Type[] ServiceTypes { get; }
public bool? IncludeDefaults { get; set; }
public bool IncludeDefaults { get; set; }
public bool? IncludeSelf { get; set; }
public bool IncludeSelf { get; set; }
public ExposeServicesAttribute(params Type[] serviceTypes)
{
@ -22,19 +22,19 @@ namespace Volo.Abp.DependencyInjection
{
var serviceList = ServiceTypes.ToList();
if (IncludeDefaults == true)
if (IncludeDefaults)
{
foreach (var type in GetDefaultServices(targetType))
{
serviceList.AddIfNotContains(type);
}
if (IncludeSelf != false)
if (IncludeSelf)
{
serviceList.AddIfNotContains(targetType);
}
}
else if (IncludeSelf == true)
else if (IncludeSelf)
{
serviceList.AddIfNotContains(targetType);
}

3
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposedServiceExplorer.cs

@ -10,7 +10,8 @@ namespace Volo.Abp.DependencyInjection
private static readonly ExposeServicesAttribute DefaultExposeServicesAttribute =
new ExposeServicesAttribute
{
IncludeDefaults = true
IncludeDefaults = true,
IncludeSelf = true
};
public static List<Type> GetExposedServices(Type type)

Loading…
Cancel
Save