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

Useful

Download Example (.NET C#)

Share Biwen.AutoClassGen

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

aaa

Category "Interface" has the following generators:

1 AutoInterface

2 Biwen.AutoClassGen

3 CopyCat

4 Farskeptic.AutoCompose

5 MakeInterface.Generator

6 Matryoshki

7 Minerals.AutoInterfaces

8 NetAutomaticInterface

9 ProxyGen

10 Roozie.AutoInterface

11 RSCG_CompositeProvider

12 rscg_Interface_to_null_object

13 RSCG_Static

14 ShadowWriterNullobjects

See category

Interface