A Visual Studio extension to automate code authoring for the Microsoft Dynamics 365 Commerce Runtime framework.
Please report any issues here.
Currently supporting:
- Visual Studio 2017 15.1 (26403.7)
- Visual Studio 2019 16.9 (693.2781)
You can install it:
- from the Visual Studio Gallery page
- or by searching by Commerce Runtime Handyman in Visual Studio -> Tools -> Extensions and Updates
- Set default project for creation of request and response classes
- Create request and response classes out of method definition, including documentation
- Navigate to the RequestHandler that implements a request type
- Right click on a variable or type for a Request and then select Navigate to request handler's implementation. Alternatively, you can use the shortcut Ctrl+F12 when the carret is over the variable or type.
- Set a default project in the solution where request and reponse classes are to be created in by right clicking on the project in the solution explorer and selecting Commerce Runtime Handyman -> Set as default Request-Response project*
- Use the light bulb suggestion Create or update request/response to generate request response classes out of a method definition
For this snippet:
/// <summary>
/// Gets a product.
/// </summary>
/// <param name="productId">The product id.</param>
/// <param name="someOtherResponseData">The first result.</param>
/// <returns>The found product.</returns>
public Product GetProducts(long productId, out string someOtherResponseData)
{
someOtherResponseData = "I will be on the response definition as well";
return new Product();
}
The following request will be generated:
/// <summary>
/// Gets a product.
/// </summary>
public class GetProductsRequest : IRequest
{
/// <summary>
/// Initializes a new instance of the <see cref="GetProductsRequest"/> class.
/// </summary>
/// <param name="productId">The product id.</param>
public GetProductsRequest(long productId)
{
this.ProductId = productId;
}
/// <summary>
/// Gets the product id.
/// </summary>
public long ProductId { get; private set; }
}
And following response will be generated:
/// <summary>
/// The response for <see cref="{GetProductsRequest}" />.
/// </summary>
public class GetProductsResponse : IResponse
{
/// <summary>
/// Initializes a new instance of the <see cref="GetProductsResponse"/> class.
/// </summary>
/// <param name="Product">The found product.</param>
/// <param name="someOtherResponseData">The first result.</param>
public GetProductsResponse(Product product, string someOtherResponseData)
{
this.Product = product;
this.SomeOtherResponseData = someOtherResponseData;
}
/// <summary>
/// Gets the found product.
/// </summary>
public Product Product { get; private set; }
/// <summary>
/// Gets the first result.
/// </summary>
public string SomeOtherResponseData { get; private set; }
}
You can configure the extension settings at Tools -> Options -> Commerce Runtime Handyman
Contributions are welcomed! Please report issues and submit pull requests here.
To build and run the extension, you will need to install Visual Studio SDK.