Skip to content
| Marketplace
Sign in
Visual Studio>Templates>CQRS Class Generator
CQRS Class Generator

CQRS Class Generator

Kazeem Quadri

|
2,731 installs
| (1) | Free
CQRS Scaffolding - Effortless Class Generation for CQRS Pattern This Visual Studio extension streamlines the creation of essential class files for implementing the CQRS (Command Query Responsibility Segregation) pattern in your .NET projects. Benefits: Save Time: Quickly ge...
Download

CQRS Scaffolding - Effortless Class Generation for CQRS Pattern

This Visual Studio extension streamlines the creation of essential class files for implementing the CQRS (Command Query Responsibility Segregation) pattern in your .NET projects.

Benefits:

  • Save Time: Quickly generate the necessary Command/Query, Handler, and Response classes with a few clicks.
  • Improve Consistency: Maintain a consistent code structure across your CQRS implementation.
  • Reduce Errors: Avoid manual code generation and potential typos.
  • Focus on Logic: Spend less time on boilerplate code and more time crafting application logic.

Prerequisites:

  • MediatR: This extension requires the MediatR package for handling communication between commands and queries. You can install it using the NuGet Package Manager within Visual Studio.
  • FluentValidation (Command Only): For command validation, the FluentValidation package is recommended. Install it similarly using NuGet.

Getting Started (Step-by-Step):

  1. Install the Extension: (Details on installation specific to your Visual Studio version may vary)

    • Open the Extensions tool window in Visual Studio (Tools > Extensions and Updates).
    • Search for "CQRS Scaffolding" or your chosen extension name.
    • Locate and install the extension.
  2. Generate CQRS Classes:

    • Right-click on your project folder in the Solution Explorer.
    • Select Add > New Item.
    • In the "Add New Item" dialog, navigate to the "CQRS Scaffolding" folder (or the folder containing your templates).
    • Choose either "CQRS Command" or "CQRS Query" depending on your needs.
    • Provide a descriptive name for your command/query (e.g., "UpdateProductCommand").
    • Click Add.

Voila! The extension will generate the corresponding class files in your project:

  • Command Template:
    • [YourCommandName]Command.cs
    • [YourCommandName]CommandHandler.cs (Handles command execution)
    • [YourCommandName]Validator.cs (Optional validation for commands)
    • [YourCommandName]Response.cs (Defines the response structure)
  • Query Template:
    • [YourQueryName]Query.cs
    • [YourQueryName]Handler.cs (Handles query execution and returns data)
    • [YourQueryName]Response.cs (Defines the response structure)

These generated files provide a solid foundation for implementing your CQRS commands and queries. You can customize the logic within the handler classes to fulfill your specific application requirements.

Note: Remember to install the required NuGet packages (MediatR and potentially FluentValidation) for your project to utilize the generated classes effectively.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft