RSCG – Biwen.AutoClassGen

RSCG – Biwen.AutoClassGen    

name Biwen.AutoClassGen
nuget https://www.nuget.org/packages/Biwen.AutoClassGen/
link https://github.com/vipwan/Biwen.AutoClassGen
author vipwan

Generating properties from interface to class.

 

This is how you can use Biwen.AutoClassGen .

The code that you start with is

  <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>   

The code that you will use is

  using FromInterface;  Console.WriteLine("Hello, World!"); Person p = new(); p.FirstName = "Andrei"; p.LastName = "Ignat"; Console.WriteLine(p.FullName());  

  The code that is generated is

 // <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  

Code and pdf at https://ignatandrei.github.io/RSCG_Examples/v2/docs/Biwen.AutoClassGen