1
1
Fork
You've already forked TypeAdoption
0
Automatic interface delegation to adopted members using source generators.
  • C# 98%
  • Dockerfile 1%
  • Shell 1%
2026年03月10日 03:01:56 +00:00
TypeAdoption Bump version 2026年03月09日 22:01:52 -05:00
TypeAdoption.Sample Avoid rendering nullable generic arguments 2026年03月09日 21:08:34 -05:00
TypeAdoption.Tests Support members in base classes 2026年02月08日 19:00:53 -06:00
TypeAdoption.Tests.Lib Avoid rendering nullable generic arguments 2026年03月09日 21:08:34 -05:00
.dockerignore Prepare for publishing to NuGet 2026年01月19日 15:12:33 -06:00
.editorconfig Disable nullable reference types in generated files 2026年02月24日 08:38:11 -06:00
.gitignore Prepare project for nuget publishing 2026年01月11日 12:37:13 -06:00
CONTRIBUTING.md Added documentation 2026年01月19日 19:58:11 -06:00
docker-compose.yml Prepare for publishing to NuGet 2026年01月19日 15:12:33 -06:00
Dockerfile Prepare for publishing to NuGet 2026年01月19日 15:12:33 -06:00
LICENSE Maintain separate README for published package 2026年01月19日 22:11:08 -06:00
project-icon.svg Bumped version, fixed project icon definition 2026年01月31日 14:02:35 -06:00
publish-library.sh Prepare for publishing to NuGet 2026年01月19日 15:12:33 -06:00
README.md Skip explicit interface method implementations 2026年02月04日 22:46:46 -06:00
TypeAdoption.slnx Initial TypeAdoption implementation 2026年01月11日 12:37:13 -06:00

TypeAdoption

TypeAdoption Logo

NuGet Version

Adopt the implementations of members in your class and embrace delegation, composition over inheritance, and mix-in style coding in C# by adding the [Adopt] attribute to members or properties:

public partial class ConfiguredLogger<T>(ILogger<T> innerLogger)
{
 [Adopt]
 private readonly ILogger<T> _innerLogger = innerLogger;
 public bool IsEnabled(LogLevel logLevel)
 {
 return logLevel > LogLevel.Debug;
 }
 // Other ILogger members are automatically delegated to _innerLogger in an automatically generated partial class.
}

Usage

Installation

Installation

Add it to your csproj:

<PackageReference Include="NameHillSoftware.TypeAdoption" Version="version" OutputItemType="Analyzer">
 <PrivateAssets>all</PrivateAssets>
</PackageReference>

More usage examples can be found in the project README.md.

Development

Credit

This project was originally started as a fork of Decorator Generator. All credit to Leopoldo Fu for their well-written library, it provided an excellent base for getting started!

License

This project is licensed under the Apache License Version 2.0 - see the LICENSE file for details.