Skip to content

Commit

Permalink
OneOf should handle Inheritance based type (#18892)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghufz committed Jun 15, 2024
1 parent 642b1a3 commit 3d93862
Show file tree
Hide file tree
Showing 97 changed files with 241 additions and 241 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
set
{
{{#oneOf}}
{{^-first}}else {{/-first}}if (value.GetType() == typeof({{{.}}}))
{{^-first}}else {{/-first}}if (value.GetType() == typeof({{{.}}}) || value is {{{.}}})
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(Apple))
if (value.GetType() == typeof(Apple) || value is Apple)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(Banana))
else if (value.GetType() == typeof(Banana) || value is Banana)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(AppleReq))
if (value.GetType() == typeof(AppleReq) || value is AppleReq)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(BananaReq))
else if (value.GetType() == typeof(BananaReq) || value is BananaReq)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(Pig))
if (value.GetType() == typeof(Pig) || value is Pig)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(Whale))
else if (value.GetType() == typeof(Whale) || value is Whale)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(Zebra))
else if (value.GetType() == typeof(Zebra) || value is Zebra)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,23 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(MixedSubId))
if (value.GetType() == typeof(MixedSubId) || value is MixedSubId)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(bool))
else if (value.GetType() == typeof(bool) || value is bool)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(decimal))
else if (value.GetType() == typeof(decimal) || value is decimal)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(int))
else if (value.GetType() == typeof(int) || value is int)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(string))
else if (value.GetType() == typeof(string) || value is string)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(Quadrilateral))
if (value.GetType() == typeof(Quadrilateral) || value is Quadrilateral)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(Triangle))
else if (value.GetType() == typeof(Triangle) || value is Triangle)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(string))
if (value.GetType() == typeof(string) || value is string)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(BasquePig))
if (value.GetType() == typeof(BasquePig) || value is BasquePig)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(DanishPig))
else if (value.GetType() == typeof(DanishPig) || value is DanishPig)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,19 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(List<string>))
if (value.GetType() == typeof(List<string>) || value is List<string>)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(Object))
else if (value.GetType() == typeof(Object) || value is Object)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(bool))
else if (value.GetType() == typeof(bool) || value is bool)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(string))
else if (value.GetType() == typeof(string) || value is string)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(ComplexQuadrilateral))
if (value.GetType() == typeof(ComplexQuadrilateral) || value is ComplexQuadrilateral)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(SimpleQuadrilateral))
else if (value.GetType() == typeof(SimpleQuadrilateral) || value is SimpleQuadrilateral)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(Quadrilateral))
if (value.GetType() == typeof(Quadrilateral) || value is Quadrilateral)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(Triangle))
else if (value.GetType() == typeof(Triangle) || value is Triangle)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(Quadrilateral))
if (value.GetType() == typeof(Quadrilateral) || value is Quadrilateral)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(Triangle))
else if (value.GetType() == typeof(Triangle) || value is Triangle)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(EquilateralTriangle))
if (value.GetType() == typeof(EquilateralTriangle) || value is EquilateralTriangle)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(IsoscelesTriangle))
else if (value.GetType() == typeof(IsoscelesTriangle) || value is IsoscelesTriangle)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(ScaleneTriangle))
else if (value.GetType() == typeof(ScaleneTriangle) || value is ScaleneTriangle)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(Apple))
if (value.GetType() == typeof(Apple) || value is Apple)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(Banana))
else if (value.GetType() == typeof(Banana) || value is Banana)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(AppleReq))
if (value.GetType() == typeof(AppleReq) || value is AppleReq)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(BananaReq))
else if (value.GetType() == typeof(BananaReq) || value is BananaReq)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(Pig))
if (value.GetType() == typeof(Pig) || value is Pig)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(Whale))
else if (value.GetType() == typeof(Whale) || value is Whale)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(Zebra))
else if (value.GetType() == typeof(Zebra) || value is Zebra)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,23 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(MixedSubId))
if (value.GetType() == typeof(MixedSubId) || value is MixedSubId)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(bool))
else if (value.GetType() == typeof(bool) || value is bool)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(decimal))
else if (value.GetType() == typeof(decimal) || value is decimal)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(int))
else if (value.GetType() == typeof(int) || value is int)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(string))
else if (value.GetType() == typeof(string) || value is string)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(Quadrilateral))
if (value.GetType() == typeof(Quadrilateral) || value is Quadrilateral)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(Triangle))
else if (value.GetType() == typeof(Triangle) || value is Triangle)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(string))
if (value.GetType() == typeof(string) || value is string)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(BasquePig))
if (value.GetType() == typeof(BasquePig) || value is BasquePig)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(DanishPig))
else if (value.GetType() == typeof(DanishPig) || value is DanishPig)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,19 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(List<string>))
if (value.GetType() == typeof(List<string>) || value is List<string>)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(Object))
else if (value.GetType() == typeof(Object) || value is Object)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(bool))
else if (value.GetType() == typeof(bool) || value is bool)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(string))
else if (value.GetType() == typeof(string) || value is string)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(ComplexQuadrilateral))
if (value.GetType() == typeof(ComplexQuadrilateral) || value is ComplexQuadrilateral)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(SimpleQuadrilateral))
else if (value.GetType() == typeof(SimpleQuadrilateral) || value is SimpleQuadrilateral)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(Quadrilateral))
if (value.GetType() == typeof(Quadrilateral) || value is Quadrilateral)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(Triangle))
else if (value.GetType() == typeof(Triangle) || value is Triangle)
{
this._actualInstance = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ public override Object ActualInstance
}
set
{
if (value.GetType() == typeof(Quadrilateral))
if (value.GetType() == typeof(Quadrilateral) || value is Quadrilateral)
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(Triangle))
else if (value.GetType() == typeof(Triangle) || value is Triangle)
{
this._actualInstance = value;
}
Expand Down
Loading

0 comments on commit 3d93862

Please sign in to comment.