特长;
我有一个从另一个对象延伸的对象。
/// <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; }
的每个属性ApiResult
都有记录,但没有 的属性ApiResult<T>
:
为什么扩展对象的文档描述为空白?我希望我<summary>
的在这里使用。我怎样才能让它显示出来?
更多细节
这是完整的代码:
/// <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)
{
}
}
这里是我的方法签名:
public ApiResult<CardInfo> GetCardInfo(string cardNumber)
以防万一,这是我的CardInfo
班级:
/// <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; }
}
我的问题是关于 Web API 2 中自动生成的帮助页面。<summary>
如果类被扩展,则在帮助页面上被忽略。