Skip to content

Effortlessly generate and integrate Onion Architecture layers into your .NET solutions. This tool automates the creation of Class Libraries, manages project references, and enforces a clean, scalable structure for maintainable applications.

Notifications You must be signed in to change notification settings

pezhvak98/Anion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anion - Onion Architecture Class Library Auto Generator

A C# Console Application for generating Class Libraries based on the Onion Architecture and automatically adding them to your .sln file. This tool simplifies project setup and enforces a clean architectural structure. Anion is derived from the combination of the words "Auto" and "Onion" and refers to the automated construction of the onion architecture structure in Asp.NET Core.

Table of Contents

About

This project automates the creation of Onion Architecture layers for your .NET solution. It creates Class Library projects, adds references between them, and integrates them into your .sln file. The generated structure supports scalable, maintainable, and testable applications.

Features

  • Automatically generates the following layers:
    • Common
    • Data
    • Entities
    • IoCConfig
    • Services
    • ViewModels
  • Adds project references between layers based on dependency rules.
  • Seamlessly integrates all Class Libraries into the existing solution file.

Prerequisites

Before using this tool, ensure you have the following installed:

  • .NET SDK (minimum version 5.0 - Built it on 8.0)
     #verify using 
     dontnet --version
  • Visual Studio or another IDE for .NET development
  • A .sln file in your project's root directory

Setup and Usage

1. Clone the Repository

git clone https://github.com/pezhvak98/Anion.git
cd Anion

2. Build the Project

Open the solution file in Visual Studio or build using the CLI:

dotnet build

3. Generate Release package

Use this command to release package to use it Globally in your system :

dotnet pack -c Release

4. Generate Release package

After the package is released, a folder named bin is created in the same path as the main package file in the Release folder. You should use that file to install the package:

dotnet tool install --global --add-source ./bin/Release Anion 

5. How to use

After building the project through Visual Studio, either using CMD outside of Visual Studio or the Package Manager Console in Visual Studio, by running the following command, all the built files and references are added to each.

Anion --Generate

Note: When you run this command, a new window will open and give you a warning about reloading the solution. You must click the Reload button after the tool finishes. If you click it while the tool is running, Visual Studio will not be able to automatically recognize the new files and you will have to manually add each of the projects from the path Right click on Solution > Add > Existing Project > Select project.

Reload Alert

Example Output:

Created: ../YourProject.Common
Created: ../YourProject.Data
...
Onion architecture Class Libraries created and added to the solution successfully.
IMPORTANT: Please click 'Reload' in Visual Studio when prompted to apply changes.

It is recommended that after the tool finishes and reloads the project, create a folder called src and place all the layers in it so that your project is better managed than before.

Uninstall

If for any reason you decide to remove this tool, you can remove it globally by simply running the following command:

dotnet tool uninstall --global Anion 

Layers

The following Class Library layers will be created:

  1. Common
    Shared components like constants, enums, and utility classes.

  2. Data
    Data access layer for interacting with databases.

  3. Entities
    Defines the domain entities.

  4. IocConfig
    Handles Dependency Injection configurations.

  5. Services
    Contains business logic services.

  6. ViewModels
    Contains data models used for presentation.


Inspired by the principles of Onion Architecture in .Net Core.

About

Effortlessly generate and integrate Onion Architecture layers into your .NET solutions. This tool automates the creation of Class Libraries, manages project references, and enforces a clean, scalable structure for maintainable applications.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages