1

Tldr;

I have a object that extends from another object.

/// <summary>
/// Represents the result of an operation
/// </summary>
[DataContract]
public class ApiResult<T> : ApiResult
{
    /// <summary>
    /// The requested data
    /// </summary>
    [DataMember]
    public T Data { get; private set; }

    /// <summary>
    /// Test
    /// </summary>
    [DataMember]
    public string Test { get; private set; }

Every property of ApiResult is documented, but not the properties of ApiResult<T>:

Documentation

Why is the documentation description blank for a extended object? I expected that my <summary> is used here. How can I make it show?


More Details

Here is the full code:

/// <summary>
/// Represents the result of an operation
/// </summary>
//[DataContract(Name = "ApiResult")]
public class ApiResult
{
    /// <summary>
    /// Indicates if the operation was performed successfull. If an error occured more Information are available in ErrorCode and Message.
    /// </summary>
    [DataMember]
    public bool IsSuccess { get; private set; }

    /// <summary>
    /// A programmable static reason, if the operation was not successfull. This can be ignored on successfull state.
    /// </summary>
    [DataMember]
    public int ErrorCode { get; private set; }

    /// <summary>
    /// Additional information about the error, if the operation was not successfull. This is only for Information purpose. Use the ErrorCode for business conditions instead.
    /// </summary>
    [DataMember]
    public string Message { get; private set; }

    /// <summary>
    /// Creates a Success Result
    /// </summary>
    public ApiResult()
    {
        IsSuccess = true;
        ErrorCode = 0;
        Message = "ok";
    }

    /// <summary>
    /// Creates a Error Result
    /// </summary>
    /// <param name="errorCode">The error code</param>
    /// <param name="message">The message</param>
    public ApiResult(int errorCode, string message)
    {
        IsSuccess = false;
        ErrorCode = errorCode;
        Message = message;
    }
}

/// <summary>
/// Represents the result of an operation
/// </summary>
//[DataContract(Name = "ApiResult")]
public class ApiResult<T> : ApiResult
{
    /// <summary>
    /// The requested data
    /// </summary>
    [DataMember]
    public T Data { get; private set; }

    /// <summary>
    /// Test
    /// </summary>
    [DataMember]
    public string Test { get; private set; }

    /// <summary>
    /// Creates a Success Result without having an actualy Result
    /// <remarks>This constructor should not be used. A parameterless constructor is needed for the automatic generation of a Documentation Example.</remarks>
    /// </summary>
    //[EditorBrowsable(EditorBrowsableState.Never)]
    //[Obsolete("Use the nongeneric version of ApiResult instead. This CTOR is only to support XmlSerialization.")]
    public ApiResult()
    {
    }

    /// <summary>
    /// Creates a Success Result
    /// </summary>
    /// <param name="data">The data</param>
    public ApiResult(T data)
    {
        Data = data;
    }

    /// <summary>
    /// Creates a Error Result
    /// </summary>
    /// <param name="errorCode">The error code</param>
    /// <param name="message">The message</param>
    public ApiResult(int errorCode, string message) : base(errorCode, message)
    {
    }

}

And here my Method signature:

public ApiResult<CardInfo> GetCardInfo(string cardNumber)

Just in case, here is my CardInfo-class:

/// <summary>
/// Information about a card
/// </summary>
public class CardInfo
{
    /// <summary>
    /// Card Type
    /// </summary>
    public string CardType { get; set; }

    /// <summary>
    /// Represents the current credit on card.
    /// Prepaid cards: CurrentValue represents the current credit on card.
    /// Postpaid: CurrentValue represents the monthly available credit amount.
    /// </summary>
    public decimal CurrentValue { get; set; }
}

My Question is about the automatic generated Help Page in Web API 2. The <summary> is ignored on the helppage, if the Class is extended.

Christian Gollhardt
  • 16,510
  • 17
  • 74
  • 111

0 Answers0