Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions LayeredCraft.DecoWeaver.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<File Path="docs\usage\opt-out.md" />
</Folder>
<Folder Name="/docs/advanced/">
<File Path="docs/advanced/instance-registrations.md" />
<File Path="docs\advanced\interceptors.md" />
<File Path="docs\advanced\source-generators.md" />
<File Path="docs\advanced\testing.md" />
Expand Down Expand Up @@ -56,18 +57,18 @@
<File Path=".github\workflows\docs.yml" />
</Folder>
<Folder Name="/samples/">
<Project Path="samples\DecoWeaver.Sample\DecoWeaver.Sample.csproj" Type="C#" />
<Project Path="samples\DecoWeaver.Sample\DecoWeaver.Sample.csproj" />
</Folder>
<Folder Name="/Solution Items/">
<File Path="Directory.Build.props" />
<File Path="README.md" />
<File Path="releasenotes.props" />
</Folder>
<Folder Name="/src/">
<Project Path="src\LayeredCraft.DecoWeaver.Attributes\LayeredCraft.DecoWeaver.Attributes.csproj" Type="C#" />
<Project Path="src\LayeredCraft.DecoWeaver.Attributes\LayeredCraft.DecoWeaver.Attributes.csproj" />
<Project Path="src\LayeredCraft.DecoWeaver.Generators\LayeredCraft.DecoWeaver.Generators.csproj" />
</Folder>
<Folder Name="/test/">
<Project Path="test\LayeredCraft.DecoWeaver.Generator.Tests\LayeredCraft.DecoWeaver.Generator.Tests.csproj" Type="C#" />
<Project Path="test\LayeredCraft.DecoWeaver.Generator.Tests\LayeredCraft.DecoWeaver.Generator.Tests.csproj" />
</Folder>
</Solution>
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Compile-time decorator registration for .NET dependency injection**

[![NuGet](https://img.shields.io/nuget/v/DecoWeaver.svg)](https://www.nuget.org/packages/DecoWeaver/)
[![NuGet](https://img.shields.io/nuget/v/LayeredCraft.DecoWeaver.svg)](https://www.nuget.org/packages/LayeredCraft.DecoWeaver/)
[![Build Status](https://github.com/LayeredCraft/decoweaver/actions/workflows/build.yaml/badge.svg)](https://github.com/LayeredCraft/decoweaver/actions/workflows/build.yaml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Documentation](https://img.shields.io/badge/docs-latest-blue)](https://layeredcraft.github.io/decoweaver/)
Expand All @@ -21,12 +21,14 @@ DecoWeaver is a .NET incremental source generator that brings **compile-time dec

📚 **[View Full Documentation](https://layeredcraft.github.io/decoweaver/)**

> **Migrating from `DecoWeaver`?** The `DecoWeaver` NuGet package has been deprecated in favor of `LayeredCraft.DecoWeaver`. Update your package reference and replace `using DecoWeaver.Attributes;` with `using LayeredCraft.DecoWeaver.Attributes;` in your code.

## Installation

Install the NuGet package:

```bash
dotnet add package DecoWeaver --prerelease
dotnet add package LayeredCraft.DecoWeaver --prerelease
```

Ensure your project uses C# 11 or later:
Expand All @@ -43,7 +45,7 @@ Ensure your project uses C# 11 or later:
### 1. Mark your implementation with the decorator to apply

```csharp
using DecoWeaver.Attributes;
using LayeredCraft.DecoWeaver.Attributes;

[DecoratedBy<LoggingRepository>]
public class UserRepository : IUserRepository
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/source-generators.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public async Task GeneratesInterceptorForDecoratedType()
{
// Arrange
var source = @"
using DecoWeaver.Attributes;
using LayeredCraft.DecoWeaver.Attributes;

[DecoratedBy<LoggingRepository>]
public class UserRepository : IUserRepository { }
Expand Down
6 changes: 3 additions & 3 deletions docs/api-reference/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class UserRepository : IUserRepository { }
#### Basic Usage

```csharp
using DecoWeaver.Attributes;
using LayeredCraft.DecoWeaver.Attributes;

[DecoratedBy<LoggingRepository>]
public class UserRepository : IUserRepository
Expand Down Expand Up @@ -155,7 +155,7 @@ Controls the order in which multiple decorators are applied. Lower values are ap
#### Basic Usage

```csharp
using DecoWeaver.Attributes;
using LayeredCraft.DecoWeaver.Attributes;

[DecoratedBy(typeof(LoggingRepository))]
public class UserRepository : IUserRepository
Expand Down Expand Up @@ -333,7 +333,7 @@ Controls the order when multiple assembly-level decorators are applied. Lower va
#### Basic Usage

```csharp
using DecoWeaver.Attributes;
using LayeredCraft.DecoWeaver.Attributes;

// Apply logging to all IRepository<T> implementations
[assembly: DecorateService(typeof(IRepository<>), typeof(LoggingRepository<>))]
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Here's a complete example showing multiple decorators working together:

```csharp
using Microsoft.Extensions.DependencyInjection;
using DecoWeaver.Attributes;
using LayeredCraft.DecoWeaver.Attributes;

// Service interface
public interface IOrderService
Expand Down
15 changes: 9 additions & 6 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,40 @@
Install DecoWeaver via the .NET CLI:

```bash
dotnet add package DecoWeaver --prerelease
dotnet add package LayeredCraft.DecoWeaver --prerelease
```

Or via Package Manager Console in Visual Studio:

```powershell
Install-Package DecoWeaver -Prerelease
Install-Package LayeredCraft.DecoWeaver -Prerelease
```

Or add directly to your `.csproj` file:

```xml
<PackageReference Include="DecoWeaver" Version="1.0.0-beta.*" />
<PackageReference Include="LayeredCraft.DecoWeaver" Version="1.0.0-beta.*" />
```

Note: The full version includes a build number suffix added by the build system (e.g., `1.0.0-beta.123`).

!!! warning "Migrating from `DecoWeaver`?"
The `DecoWeaver` NuGet package has been deprecated. Replace it with `LayeredCraft.DecoWeaver` and update all `using DecoWeaver.Attributes;` statements to `using LayeredCraft.DecoWeaver.Attributes;`.

## Package Contents

The DecoWeaver NuGet package includes:

- **DecoWeaver.Attributes.dll** - Runtime attributes (zero footprint with `[Conditional]`)
- **DecoWeaver.dll** - Source generator (build-time only)
- **LayeredCraft.DecoWeaver.Attributes.dll** - Runtime attributes (zero footprint with `[Conditional]`)
- **LayeredCraft.DecoWeaver.Generators.dll** - Source generator (build-time only)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use the packaged analyzer DLL name in installation docs

The package-contents section now says the source generator file is LayeredCraft.DecoWeaver.Generators.dll, but the generator project explicitly packs $(AssemblyName).dll with AssemblyName set to $(PackageId) and PackageId=LayeredCraft.DecoWeaver (src/LayeredCraft.DecoWeaver.Generators/LayeredCraft.DecoWeaver.Generators.csproj, properties and pack item). This means consumers will actually see LayeredCraft.DecoWeaver.dll, so the current text sends users to the wrong filename when validating package contents (and the same naming assumption is repeated in generated-path instructions).

Useful? React with 👍 / 👎.


## Verify Installation

After installation, verify the generator is working:

1. Add a simple decorator attribute to a class
2. Build your project
3. Check for generated files in `obj/Debug/{targetFramework}/generated/DecoWeaver/`
3. Check for generated files in `obj/Debug/{targetFramework}/generated/LayeredCraft.DecoWeaver.Generators/`

## IDE Support

Expand Down
8 changes: 4 additions & 4 deletions docs/getting-started/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Get started with DecoWeaver in 5 minutes by creating a simple logging decorator.
## Step 1: Install DecoWeaver

```bash
dotnet add package DecoWeaver --prerelease
dotnet add package LayeredCraft.DecoWeaver --prerelease
```

## Step 2: Create Your Service
Expand Down Expand Up @@ -71,7 +71,7 @@ public class LoggingUserService : IUserService
Add the `[DecoratedBy]` attribute to your implementation:

```csharp
using DecoWeaver.Attributes;
using LayeredCraft.DecoWeaver.Attributes;

[DecoratedBy<LoggingUserService>]
public class UserService : IUserService
Expand Down Expand Up @@ -115,7 +115,7 @@ await userService.GetByIdAsync(123);

To see the generated interceptor code:

**Visual Studio**: Solution Explorer → Show All Files → obj/Debug/net8.0/generated/DecoWeaver/
**Visual Studio**: Solution Explorer → Show All Files → obj/Debug/net8.0/generated/LayeredCraft.DecoWeaver.Generators/

**Rider**: Solution Explorer → Generated Files node

Expand All @@ -125,7 +125,7 @@ Instead of applying decorators to each class individually, you can apply them to

```csharp
// In GlobalUsings.cs or any .cs file
using DecoWeaver.Attributes;
using LayeredCraft.DecoWeaver.Attributes;

[assembly: DecorateService(typeof(IUserService), typeof(LoggingUserService))]

Expand Down
11 changes: 7 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# DecoWeaver

[![Build Status](https://github.com/layeredcraft/decoweaver/actions/workflows/build.yaml/badge.svg)](https://github.com/layeredcraft/decoweaver/actions/workflows/build.yaml)
[![NuGet](https://img.shields.io/nuget/v/DecoWeaver.svg)](https://www.nuget.org/packages/DecoWeaver/)
[![Downloads](https://img.shields.io/nuget/dt/DecoWeaver.svg)](https://www.nuget.org/packages/DecoWeaver/)
[![NuGet](https://img.shields.io/nuget/v/LayeredCraft.DecoWeaver.svg)](https://www.nuget.org/packages/LayeredCraft.DecoWeaver/)
[![Downloads](https://img.shields.io/nuget/dt/LayeredCraft.DecoWeaver.svg)](https://www.nuget.org/packages/LayeredCraft.DecoWeaver/)

**DecoWeaver** is a compile-time decorator registration library for .NET dependency injection. It uses C# 11+ interceptors to automatically apply the decorator pattern at build time, eliminating runtime reflection and assembly scanning.

Expand All @@ -19,10 +19,13 @@
- **🔗 Order Control**: Explicit decorator ordering via `Order` property
- **✨ Clean Generated Code**: Readable, debuggable interceptor code

!!! warning "Migrating from `DecoWeaver`?"
The `DecoWeaver` NuGet package has been deprecated in favor of `LayeredCraft.DecoWeaver`. Update your package reference and replace `using DecoWeaver.Attributes;` with `using LayeredCraft.DecoWeaver.Attributes;` in your code.

## Installation

```bash
dotnet add package DecoWeaver --prerelease
dotnet add package LayeredCraft.DecoWeaver --prerelease
```

## Quick Start
Expand Down Expand Up @@ -73,7 +76,7 @@ public class LoggingUserRepository : IUserRepository
### 3. Apply the Decorator Attribute

```csharp
using DecoWeaver.Attributes;
using LayeredCraft.DecoWeaver.Attributes;

[DecoratedBy<LoggingUserRepository>]
public class UserRepository : IUserRepository
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/assembly-level-decorators.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Assembly-level decorators provide a centralized way to apply decorators to multi
Use the `[assembly: DecorateService(...)]` attribute in any `.cs` file (commonly in `GlobalUsings.cs` or `AssemblyInfo.cs`):

```csharp
using DecoWeaver.Attributes;
using LayeredCraft.DecoWeaver.Attributes;

[assembly: DecorateService(typeof(IRepository<>), typeof(CachingRepository<>))]
```
Expand Down Expand Up @@ -358,7 +358,7 @@ Keep all assembly-level decorators in one file:

```csharp
// GlobalUsings.cs or AssemblyDecorators.cs
using DecoWeaver.Attributes;
using LayeredCraft.DecoWeaver.Attributes;

// Repositories
[assembly: DecorateService(typeof(IRepository<>), typeof(LoggingRepository<>), Order = 10)]
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/class-level-decorators.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The `[DecoratedBy]` attribute is the primary way to apply decorators in DecoWeav
The most common and type-safe approach:

```csharp
using DecoWeaver.Attributes;
using LayeredCraft.DecoWeaver.Attributes;

[DecoratedBy<LoggingDecorator>]
public class UserRepository : IUserRepository
Expand All @@ -26,7 +26,7 @@ public class UserRepository : IUserRepository
Alternative syntax using `typeof()`:

```csharp
using DecoWeaver.Attributes;
using LayeredCraft.DecoWeaver.Attributes;

[DecoratedBy(typeof(LoggingDecorator))]
public class UserRepository : IUserRepository
Expand Down
Loading