RSCG – Roozie.AutoInterface

RSCG – Roozie.AutoInterface
 
 

name Roozie.AutoInterface
nuget https://www.nuget.org/packages/Roozie.AutoInterface/
link https://github.com/AlexRussak/Roozie.AutoInterface
author Alex Russak

Generating interfaces from project

 

This is how you can use Roozie.AutoInterface .

The code that you start with is


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

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

  <ItemGroup>
    <PackageReference Include="Roozie.AutoInterface" Version="0.6.1" />
  </ItemGroup>
	<PropertyGroup>
		<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
		<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
	</PropertyGroup>
</Project>


The code that you will use is


using Roozie.AutoInterfaceDemo;

IPerson p = new Person();
p.FirstName = "Andrei";
p.LastName = "Ignat";
Console.WriteLine(p.FullName() );


using Roozie.AutoInterface;

namespace Roozie.AutoInterfaceDemo;

[AutoInterface(IncludeMethods =true,IncludeProperties =true)]
public partial class Person
{
    public int ID { get; set; }
    public string? FirstName { get; set; }
    public string? LastName { get; set; }
    public string FullName()
    {
        return FirstName + " " + LastName;
    }
}


 

The code that is generated is

// <auto-generated>
// This file was generated by Roozie.AutoInterface v0.6.1.0
// </auto-generated>

using Roozie.AutoInterface;

namespace Roozie.AutoInterfaceDemo;

#nullable enable

public partial class Person : IPerson {}

public partial interface IPerson
{
    int ID { get; set; }

    string? FirstName { get; set; }

    string? LastName { get; set; }

    string FullName();

}

Code and pdf at

https://ignatandrei.github.io/RSCG_Examples/v2/docs/Roozie.AutoInterface