Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ public class ExposeServicesAttribute : Attribute, IExposedServiceTypesProvider
{
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)
{
Expand All @@ -22,19 +22,19 @@ public Type[] GetExposedServiceTypes(Type targetType)
{
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public static class ExposedServiceExplorer
private static readonly ExposeServicesAttribute DefaultExposeServicesAttribute =
new ExposeServicesAttribute
{
IncludeDefaults = true
IncludeDefaults = true,
IncludeSelf = true
};

public static List<Type> GetExposedServices(Type type)
Expand Down