Skip to main content

Biwen.AutoClassGen by vipwan

Nuget / site data

Nuget GitHub last commit GitHub Repo stars

Details

Info

info

Name: Biwen.AutoClassGen

Biwen.AutoClassGen, CodeGEN

Author: vipwan

NuGet: https://www.nuget.org/packages/Biwen.AutoClassGen/

You can find more details at https://github.com/vipwan/Biwen.AutoClassGen

Source : https://github.com/vipwan/Biwen.AutoClassGen

Original Readme

note

Biwen.AutoClassGen

Usage scenario

  • In many cases, we will have a lot of request objects, such as GetIdRequest, GetUserRequest, etc..., and these requests may have a large number of the same fields. For example, the multi-tenant Id, the number of pages, and these attribute fields may have validation rules, binding rules, and Swagger descriptions. If all this code needs to be written, it will add a lot of work, so Biwen.AutoClassGen came into being to solve this pain point...
  • In many cases, we will have a lot of DTO objects,
  • AOP & Decorator

中文

Usage

dotnet add package Biwen.AutoClassGen.Attributes

Used by

if you use this library, please tell me, I will add your project here.

About

note

Generating properties from interface to class.

How to use

Example ( source csproj, source files )

This is the CSharp Project that references Biwen.AutoClassGen

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Biwen.AutoClassGen" Version="1.0.0.6" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<PackageReference Include="Biwen.AutoClassGen.Attributes" Version="1.0.0" />

</ItemGroup>

<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
</PropertyGroup>

</Project>

Generated Files

Those are taken from $(BaseIntermediateOutputPath)\GX

// <auto-generated />
// author:vipwan@outlook.com 万雅虎
// issue:https://github.com/vipwan/Biwen.AutoClassGen/issues
// 如果你在使用中遇到问题,请第一时间issue,谢谢!
// This file is generated by Biwen.AutoClassGen.SourceGenerator
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using FromInterface;

#pragma warning disable
namespace FromInterface
{
public partial class Person : IPerson2
{
/// <inheritdoc cref = "IPerson.FirstName"/>
[System.ComponentModel.DataAnnotations.StringLengthAttribute(100)]
[System.ComponentModel.DescriptionAttribute("person first name")]
public string FirstName { get; set; }
/// <inheritdoc cref = "IPerson.LastName"/>
public string LastName { get; set; }
}
}
#pragma warning restore

Usefull

Download Example (.NET C# )

Share Biwen.AutoClassGen

https://ignatandrei.github.io/RSCG_Examples/v2/docs/Biwen.AutoClassGen

In the same category (Interface) - 9 other generators

CopyCat

Farskeptic.AutoCompose

MakeInterface.Generator

Matryoshki

Minerals.AutoInterfaces

NetAutomaticInterface

ProxyGen

Roozie.AutoInterface

RSCG_Static