WasmAI.AutoGenerator.API 1.0.0-c

This is a prerelease version of WasmAI.AutoGenerator.API.
dotnet add package WasmAI.AutoGenerator.API --version 1.0.0-c
                    
NuGet\Install-Package WasmAI.AutoGenerator.API -Version 1.0.0-c
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WasmAI.AutoGenerator.API" Version="1.0.0-c" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WasmAI.AutoGenerator.API" Version="1.0.0-c" />
                    
Directory.Packages.props
<PackageReference Include="WasmAI.AutoGenerator.API" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WasmAI.AutoGenerator.API --version 1.0.0-c
                    
#r "nuget: WasmAI.AutoGenerator.API, 1.0.0-c"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WasmAI.AutoGenerator.API@1.0.0-c
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WasmAI.AutoGenerator.API&version=1.0.0-c&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=WasmAI.AutoGenerator.API&version=1.0.0-c&prerelease
                    
Install as a Cake Tool

πŸš€ WasmAI.AutoGenerator

WasmAI.AutoGenerator is a powerful code-generation library for .NET 8 that automates the scaffolding of backend components like models, services, controllers, and moreβ€”based on a flexible folder configuration.


✨ Features

  • βš™οΈ Automatic Generation of Backend Layers:

    • DTOs (Data Transfer Objects)
    • DSOs (Domain Service Objects)
    • Repositories
    • Services
    • Controllers
    • Validators
    • Schedulers
  • πŸ—‚οΈ Dynamic Folder and File Generation: Uses folderStructure.json to generate nested folders and files.

  • πŸ—οΈ Architecture Pattern Support: Built-in templates: Country, Plug, Share, Builder, Service, and Scope.

  • πŸ› οΈ Customizable & Modular: Easily adapt to any backend architecture style.

  • πŸ” Service Lifetime Support: Scoped, singleton, and transient services supported.

  • πŸ”” Built-in Notification Provider: Supports Email, SMS, Push, and In-App notifications.


🧱 Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Models    │──────▢│ Marker Interfaces  │──────▢│ AutoGenerator  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                        β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚   DTOs     β”‚ Repositoriesβ”‚  Services    β”‚ Controllers β”‚  Validators  β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“¦ Installation

dotnet add package WasmAI.AutoGenerator --version 1.1.0

πŸ‘‰ After installation, add the necessary namespace:

using AutoGenerator.ApiFolder;

πŸ“ Folder Structure Configuration (folderStructure.json)

Here's an example:

{
  "Controllers": [ "Api", "Auth", "Admin" ],
  "Repositories": [ "Base", "Builder", "Share" ],
  "Services": [ "Email", "Logging" ],
  "DyModels": [
    {
      "VM": [],
      "Dto": {
        "Build": [ "Request", "Response", "ResponseFilter" ],
        "Share": [ "Request", "Response", "ResponseFilter" ]
      },
      "Dso": [ "Request", "Response", "ResponseFilter" ]
    }
  ],
  "Config": [ "Mappers", "Scopes", "Singletons", "Transients" ],
  "Models": [],
  "Builders": [ "Db" ],
  "Helper": [],
  "Data": [],
  "Enums": [],
  "Validators": [ "Conditions" ],
  "Schedulers": []
}

πŸ—οΈ How to Generate Your Backend Architecture

βœ… Option 1: Programmatically

using AutoGenerator.ApiFolder;
using System;

class Program
{
    static void Main(string[] args)
    {
        string projectPath = "path_to_your_project";
        ApiFolderGenerator.Build(projectPath);
        Console.WriteLine("βœ… All folders have been created successfully!");
    }
}
dotnet run generate

This command reads the folderStructure.json and creates all required folders and files instantly.


Steps to Implement DataContext and CategoryModel with ITModel and ITAutoDbContext

1. Create Your DataContext

First, you need to make sure that DataContext inherits from AutoIdentityDataContext and implements ITAutoDbContext. This allows you to manage identity operations and database access in a simple and automated way.

Code:

public class DataContext : AutoIdentityDataContext<ApplicationUser, IdentityRole, string>, ITAutoDbContext
{
    // Add properties like DbSet for your models
    public DbSet<CategoryModel> Categories { get; set; }

    public DataContext(DbContextOptions<DataContext> options) : base(options)
    {
    }

    // You can add any custom functions for DbContext here
}

Explanation:

  • DataContext inherits from AutoIdentityDataContext<ApplicationUser, IdentityRole, string> because you need to work with identity management using ApplicationUser and IdentityRole.
  • ITAutoDbContext ensures that the DataContext can handle automatic operations.
  • DbSet<CategoryModel> is an example of adding a model to DataContext so it can be interacted with in the database.

2. Create CategoryModel and Implement ITModel

Now, you need to implement the ITModel interface in your models like CategoryModel to take advantage of automatic operations.

Code:

public class CategoryModel : ITModel
{
    [Key]
    public string? Id { get; set; } = $"catm_{Guid.NewGuid():N}";  // Automatically generates a unique value

    [Required]
    [ToTranslation]  // Mark to ensure the field is translated automatically
    public string? Name { get; set; }

    [ToTranslation]  // Mark to ensure the field is translated automatically
    public string? Description { get; set; }
}

Explanation:

  • The CategoryModel class implements ITModel, which means it includes an Id property that gets automatically generated using Guid.NewGuid().
  • The Name and Description properties have the [ToTranslation] attribute to indicate that they should be translated automatically.

πŸ”§ API Builder Configuration

Here’s how to configure it in your project:

builder.Services
    . AddAutoBuilderApiCore<DataContext,ApplicationUser>(new()
    {
        Arags = args,
        NameRootApi = "V1",
        IsMapper = true,
        Assembly = Assembly.GetExecutingAssembly(),
        DbConnectionString = builder.Configuration.GetConnectionString("DefaultConnection"),
        ProjectPath= "folderStructure.json"
    })
    .AddAutoValidator()
    .AddAutoConfigScheduler()
    .AddAutoNotifier(new()
    {
        MailConfiguration = new MailConfig()
        {
            SmtpUsername = "user@gmail.com",
            SmtpPassword = "your_smtp_password",  // πŸ”’ Secure this!
            SmtpHost = "smtp.gmail.com",
            SmtpPort = 587,
            FromEmail = "user@gmail.com",
            NameApp = "app"
        },
       // sms
      //  push web any platforms
    });

πŸš€ Command Line Generation Options

dotnet run generate
# Basic Generation
dotnet run generate                   # Standard generation
dotnet run generate /m               # With Model Generator
dotnet run generate /m/ai            # AI-Assisted generation

# 🏒 BPR ENTERPRISE PATTERNS
dotnet run generate /bpr c:dso       # Domain Service Objects
dotnet run generate /bpr c:share     # Shared DTO Pattern  
dotnet run generate /bpr c:build     # Builder Pattern
dotnet run generate /bpr c:all       # Complete Enterprise Stack

# πŸ”„ COMBINED WORKFLOWS
dotnet run generate /bpr c:dso /m    # DSO + Model Generator
dotnet run generate /bpr c:all /m/ai # Complete AI-Assisted

# πŸ” AUTHENTICATION COMMANDS
dotnet run generate /bpr e:auth      # Add authentication files (skip if exists)
dotnet run generate /bpr e:nauth     # Force create new auth files

# πŸ’³ PAYMENT INTEGRATION COMMANDS
dotnet run generate /bpr e:payment   # Add payment provider infrastructure
dotnet run generate /bpr e:payment stripe   # Add Stripe payment integration
dotnet run generate /bpr e:payment paypal   # Add PayPal payment integration
dotnet run generate /bpr e:payment all     # Add all payment providers

# 🎯 COMBINED AUTH & PAYMENT
dotnet run generate /bpr e:auth e:payment  # Auth + Payment infrastructure
dotnet run generate /bpr c:all e:auth e:payment /m/ai  # Complete stack with AI

🏁 Getting Started Example

Updated Program.cs Implementation

using System.Diagnostics;
using System.Reflection;
using AutoGenerator;
using AutoGenerator.Config;
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using WasmAI.AutoGenerator.Auth;
using WasmAI.PaymentProvider.Data;
using WasmAI.PaymentProvider.Models;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();

// βœ… Enhanced Main Service Registration
builder.Services
    .AddWasmAutoGeneratorApi<PaymentDbContext, ApplicationUser>(new()
    {
        Arags = args,
        NameRootApi = "v1",
        Assembly = Assembly.GetExecutingAssembly(),
        DbConnectionString = builder.Configuration.GetConnectionString("DefaultConnection"),
    });

var app = builder.Build();

// βœ… Enhanced Middleware Registration
app.UseWasmAutoGeneratorApi();

app.UseHttpsRedirection();
app.MapControllers();
app.Run();

βœ… Conclusion

WasmAI.AutoGenerator supercharges your .NET development by reducing boilerplate and enforcing clean, modular architecture. Whether you're building an admin panel, a complex API, or a service-oriented backendβ€”this tool lets you build your project architecture in seconds with:


Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-c 34 2/7/2026
1.0.0-b 54 1/29/2026
1.0.0-a 43 1/29/2026