/// <summary> /// Adds TDerivedType to the list of derived type constraints for the return type. /// </summary> /// <returns>Updated configuration object.</returns> public ActionConfiguration HasDerivedTypeConstraintForReturnType <TDerivedType>() { if (ReturnType == null) { throw Error.InvalidOperation(SRResources.ReturnTypeOfOperationNotSpecified); } if (ReturnTypeConstraints == null) { ReturnTypeConstraints = new DerivedTypeConstraintConfiguration(); } ReturnTypeConstraints.AddConstraint <TDerivedType>(); return(this); }
/// <summary> /// Adds subtypes to the list of derived type constraints for the return type. /// </summary> /// <param name="subtypes">The subtypes for which the constraint needs to be added.</param> /// <returns>Updated configuration object.</returns> public FunctionConfiguration HasDerivedTypeConstraintsForReturnType(params Type[] subtypes) { if (ReturnType == null) { throw Error.InvalidOperation(SRResources.ReturnTypeOfOperationNotSpecified); } if (ReturnTypeConstraints == null) { ReturnTypeConstraints = new DerivedTypeConstraintConfiguration(); } ReturnTypeConstraints.AddConstraints(subtypes); return(this); }