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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
7 additions and
6 deletions
-
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposeServicesAttribute.cs
-
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposedServiceExplorer.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); |
|
|
|
} |
|
|
|
|
|
|
|
@ -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) |
|
|
|
|