I have a generic abstract base class that has some methods on it. Those methods have XML Comments on them as such:
/// <summary>
/// Controller for working with instances of {TModel}
/// </summary>
public abstract class BaseController<TModel> : ApiController
{
/// <summary>
/// Creates a {TModel}.
/// </summary>
[HttpPost]
public Task<TModel> Post([FromBody] TModel model)
{
...
return ...
}
}
I would like to be able to implement it as such:
/// <summary>
/// Controller for working with instances of PersonModel
/// </summary>
public class PersonController : BaseController<PersonModel>
{
}
And have XML comments generated for PersonController that mimic the comments on the base class. That would allow something fancy like https://github.com/domaindrivendev/Swashbuckle to pick up my XML Comments and display them nicely for the PersonController.
Currently the comments come out as follows:
<?xml version="1.0"?>
<doc>
<assembly>
<name>MyLibrary</name>
</assembly>
<members>
<member name="T:MyLibrary.PersonController">
<summary>
Controller for working with instances of PersonModel
</summary>
</member>
<member name="T:MyLibrary.BaseController`1">
<summary>
Controller for working with instances of {TModel}
</summary>
</member>
<member name="M:MyLibrary.BaseController`1.Post(`0)">
<summary>
Creates a {TModel}.
</summary>
</member>
</members>
</doc>
I would like it to also include a method documentation for the post method on PersonController, too:
...
<member name="M:MyLibrary.PersonController.Post(`0)">
<summary>
Creates a PersonModel.
</summary>
</member>
...
At this point, I feel I've wasted too much time trying to figure out how to make it do what I want. Can any of you help me find a shortcut?