Skip to content

Commit 8ca4c14

Browse files
committed
changed the default to Throw if required property is unresolved #567, #563
1 parent 7ee0ea1 commit 8ca4c14

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

samples/BlazorServerSide/Program.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
// todo: @wip take into account constructor with SetsRequiredMembers attribute
1616
var requiredProperties = PropertiesAndFields.All(withFields: false,
17-
serviceInfo: (p, _) => p.GetCustomAttribute<RequiredMemberAttribute>() != null ? PropertyOrFieldServiceInfo.Of(p) : null);
17+
serviceInfo: (p, _) => p.GetCustomAttribute<RequiredMemberAttribute>() == null ? null
18+
: PropertyOrFieldServiceInfo.Of(p).WithDetails(ServiceDetails.Of(IfUnresolved.Throw)));
1819

1920
var container = new Container(Rules.MicrosoftDependencyInjectionRules.With(propertiesAndFields: requiredProperties));
2021

0 commit comments

Comments
 (0)