Browse Source

Merge pull request #2253 from abpframework/maliming/ExposeServicesAttribute

Change the nullable parameter of ExposeServices to a non-nullable type.
pull/2272/head
Halil İbrahim Kalkan 7 years ago
committed by GitHub
parent
commit
e20f6b0662
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  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 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) public ExposeServicesAttribute(params Type[] serviceTypes)
{ {
@ -22,19 +22,19 @@ namespace Volo.Abp.DependencyInjection
{ {
var serviceList = ServiceTypes.ToList(); var serviceList = ServiceTypes.ToList();
if (IncludeDefaults == true) if (IncludeDefaults)
{ {
foreach (var type in GetDefaultServices(targetType)) foreach (var type in GetDefaultServices(targetType))
{ {
serviceList.AddIfNotContains(type); serviceList.AddIfNotContains(type);
} }
if (IncludeSelf != false) if (IncludeSelf)
{ {
serviceList.AddIfNotContains(targetType); serviceList.AddIfNotContains(targetType);
} }
} }
else if (IncludeSelf == true) else if (IncludeSelf)
{ {
serviceList.AddIfNotContains(targetType); 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 = private static readonly ExposeServicesAttribute DefaultExposeServicesAttribute =
new ExposeServicesAttribute new ExposeServicesAttribute
{ {
IncludeDefaults = true IncludeDefaults = true,
IncludeSelf = true
}; };
public static List<Type> GetExposedServices(Type type) public static List<Type> GetExposedServices(Type type)

Loading…
Cancel
Save