Guest User

Untitled

a guest
Mar 24th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. /// <summary>
  2. /// Adds Tenant Id field to API endpoints
  3. /// </summary>
  4. /// <seealso cref="Swashbuckle.AspNetCore.SwaggerGen.IOperationFilter" />
  5. public class TenantHeaderOperationFilter : IOperationFilter
  6. {
  7. /// <summary>
  8. /// Applies the specified operation.
  9. /// </summary>
  10. /// <param name="operation">The operation.</param>
  11. /// <param name="context">The context.</param>
  12. public void Apply(Operation operation, OperationFilterContext context)
  13. {
  14. if (operation.Parameters == null)
  15. {
  16. operation.Parameters = new List<IParameter>();
  17. }
  18. operation.Parameters.Add(new NonBodyParameter
  19. {
  20. Name = "tenantid",
  21. In = "header",
  22. Description = "tenantid",
  23. Required = true,
  24. Type = "string",
  25. });
  26. }
  27. }
Add Comment
Please, Sign In to add comment