我正在使用SandCastle记录我目前正在开发的API。在设置端点时,我定义了以下基类:
/// <summary>
/// The base class for all services operating in the API.
/// </summary>
/// <typeparam name="T">The type of object to be controlled via the given service</typeparam>
/// <typeparam name="TPrimaryKey">The type of the primary key for the object to be controlled via the given service</typeparam>
public abstract class BaseService<T, TPrimaryKey> : ServiceContracts.IBaseService<T, TPrimaryKey>
where T : class
{
/// <summary>
/// Adds or updates the given item.
/// </summary>
/// <param name="item">The item to be added or updated.</param>
public void AddOrUpdate(T item)
{
// perform setup / validation
PerformAddOrUpdate(item);
// perform teardown
}
protected abstract void PerformAddOrUpdate(T item);
}
然后我有各种服务实现,如:
/// <summary>
/// Service that allows for <see cref="DataContracts.Product"/> records to be controlled via the API.
/// </summary>
public class ProductService : BaseService<Product, long?>, IProductService
{
/// <summary>
/// Creates or updates the given product record.
/// If a product with the item's Id exists, that record will be updated.
/// Otherwise, a new record will be created.
/// </summary>
/// <param name="item">The <see cref="DataContracts.Product"/> to be added or updated.</param>
protected override void PerformAddOrUpdate(Product item)
{
throw new NotImplementedException();
}
}
现在,当我生成文档时,我不想公开受保护的方法,因为服务的使用者不需要关心那些实现细节。但是,ProductService.PerformAddOrUpdate(Product)
上的摘要具有允许调用者知道何时会发生添加而不是更新的信息(即,它具有非通用摘要信息)。
是否可以与<inheritdoc />
相反,因此当消费者看到AddOrUpdate
时,他们会获得子类PerformAddOrUpdate
的文档?
提前致谢。
修改 现在的文档示例:
我希望此说明(目前“添加或更新给定项目。”)仅从<summary>
获取此视图(因此,每个子将显示自己的PerformAddOrUpdate
,因为它被覆盖时将在自己的范围内。直接查看<summary>
时,它应该像现在一样显示BaseService
。