Skip to content

Commit 2a2cab7

Browse files
committed
Some renames
1 parent 7163d0c commit 2a2cab7

11 files changed

Lines changed: 23 additions & 23 deletions

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Let's keep pushing for clarity, usability, and excellence—both in code and use
3636
- Order with `[FoundatioOrder(int)]`; lower runs earlier in Before and later in After/Finally.
3737

3838
## DI and generation
39-
- Register: `services.AddMediator()` (see `src/Foundatio.Mediator.Abstractions/MediatorExtensions.cs`). Generator emits `[assembly: FoundatioHandlerModule]` and DI `HandlerRegistration` per message.
39+
- Register: `services.AddMediator()` (see `src/Foundatio.Mediator.Abstractions/MediatorExtensions.cs`). Generator emits `[assembly: FoundatioModule]` and DI `HandlerRegistration` per message.
4040
- Handlers are not auto-registered; wrappers create instances via `ActivatorUtilities` if not in DI. Register handlers to control lifetime.
4141
- Middleware lifetime: `Mediator.GetOrCreateMiddleware<T>` caches if not in DI; register to control lifetime.
4242

docs/guide/handler-conventions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,21 +292,21 @@ The source generator scans the current assembly for:
292292

293293
### Manual Handler Discovery
294294

295-
Handler classes can implement the `IFoundatioHandler` interface for manual discovery:
295+
Handler classes can implement the `IHandler` interface for manual discovery:
296296

297297
```csharp
298-
public class UserProcessor : IFoundatioHandler
298+
public class UserProcessor : IHandler
299299
{
300300
public User Handle(GetUser query) { } // ✅ Discovered
301301
}
302302
```
303303

304-
Handler classes and methods can be marked with the `[FoundatioHandler]` attribute for manual discovery:
304+
Handler classes and methods can be marked with the `[Handler]` attribute for manual discovery:
305305

306306
```csharp
307307
public class UserProcessor
308308
{
309-
[FoundatioHandler]
309+
[Handler]
310310
public User Process(GetUser query) { } // ✅ Discovered
311311
}
312312
```

src/Foundatio.Mediator.Abstractions/FoundatioHandlerModuleAttribute.cs renamed to src/Foundatio.Mediator.Abstractions/FoundatioModuleAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
namespace Foundatio.Mediator;
22

33
[AttributeUsage(AttributeTargets.Assembly)]
4-
public sealed class FoundatioHandlerModuleAttribute : Attribute { }
4+
public sealed class FoundatioModuleAttribute : Attribute { }

src/Foundatio.Mediator.Abstractions/FoundatioHandlerAttribute.cs renamed to src/Foundatio.Mediator.Abstractions/HandlerAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace Foundatio.Mediator;
22

33
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
4-
public sealed class FoundatioHandlerAttribute : Attribute
4+
public sealed class HandlerAttribute : Attribute
55
{
66
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
namespace Foundatio.Mediator;
22

33
// Marker interface for classes that should be treated as mediator handlers
4-
public interface IFoundatioHandler { }
4+
public interface IHandler { }

src/Foundatio.Mediator.Abstractions/MediatorExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static IServiceCollection AddMediator(this IServiceCollection services, M
2424

2525
foreach (var assembly in configuration.Assemblies!)
2626
{
27-
if (!IsAssemblyMarkedWithFoundatioHandlerModule(assembly))
27+
if (!IsAssemblyMarkedWithFoundatioModule(assembly))
2828
continue;
2929

3030
var moduleType = assembly.GetTypes().FirstOrDefault(t =>
@@ -57,9 +57,9 @@ public static IServiceCollection AddMediator(this IServiceCollection services, A
5757
return services.AddMediator(configurationBuilder.Build());
5858
}
5959

60-
private static bool IsAssemblyMarkedWithFoundatioHandlerModule(Assembly assembly)
60+
private static bool IsAssemblyMarkedWithFoundatioModule(Assembly assembly)
6161
{
62-
return assembly.GetCustomAttributes(typeof(FoundatioHandlerModuleAttribute), false).Any();
62+
return assembly.GetCustomAttributes(typeof(FoundatioModuleAttribute), false).Any();
6363
}
6464
}
6565

src/Foundatio.Mediator/DIRegistrationGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static void Execute(SourceProductionContext context, List<HandlerInfo> ha
2323
source.AppendLine("using System.Threading;");
2424
source.AppendLine("using System.Threading.Tasks;");
2525
source.AppendLine();
26-
source.AppendLine("[assembly: Foundatio.Mediator.FoundatioHandlerModule]");
26+
source.AppendLine("[assembly: Foundatio.Mediator.FoundatioModule]");
2727
source.AppendLine();
2828
source.AppendLine("namespace Foundatio.Mediator;");
2929
source.AppendLine();

src/Foundatio.Mediator/HandlerAnalyzer.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ public static bool IsMatch(SyntaxNode node)
2828
_ => (bt.Type as IdentifierNameSyntax)?.Identifier.ValueText
2929
};
3030

31-
if (typeName == "IFoundatioHandler")
31+
if (typeName == "IHandler")
3232
return true;
3333
}
3434
}
3535

3636
if (classDecl.AttributeLists.Count > 0 && classDecl.AttributeLists
3737
.SelectMany(al => al.Attributes)
38-
.Any(a => a.Name is IdentifierNameSyntax { Identifier.ValueText: "FoundatioHandler" }
38+
.Any(a => a.Name is IdentifierNameSyntax { Identifier.ValueText: "Handler" }
3939
or QualifiedNameSyntax
4040
{
41-
Right.Identifier.ValueText: "FoundatioHandler"
41+
Right.Identifier.ValueText: "Handler"
4242
}))
4343
{
4444
return true;
@@ -50,10 +50,10 @@ or QualifiedNameSyntax
5050
continue;
5151

5252
if (m.AttributeLists.SelectMany(al => al.Attributes)
53-
.Any(a => a.Name is IdentifierNameSyntax { Identifier.ValueText: "FoundatioHandler" }
53+
.Any(a => a.Name is IdentifierNameSyntax { Identifier.ValueText: "Handler" }
5454
or QualifiedNameSyntax
5555
{
56-
Right.Identifier.ValueText: "FoundatioHandler"
56+
Right.Identifier.ValueText: "Handler"
5757
}))
5858
{
5959
return true;
@@ -79,7 +79,7 @@ public static List<HandlerInfo> GetHandlers(GeneratorSyntaxContext context)
7979

8080
// Determine if the class should be treated as a handler class
8181
bool nameMatches = classSymbol.Name.EndsWith("Handler") || classSymbol.Name.EndsWith("Consumer");
82-
bool implementsMarker = classSymbol.AllInterfaces.Any(i => i.ToDisplayString() == "Foundatio.Mediator.IFoundatioHandler");
82+
bool implementsMarker = classSymbol.AllInterfaces.Any(i => i.ToDisplayString() == "Foundatio.Mediator.IHandler");
8383
bool hasClassHandlerAttribute = classSymbol.GetAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == WellKnownTypes.HandlerAttribute);
8484

8585
bool treatAsHandlerClass = nameMatches || implementsMarker || hasClassHandlerAttribute;

src/Foundatio.Mediator/Utility/TypeExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,6 @@ internal static class WellKnownTypes {
169169
public const string ResultOfT = "Foundatio.Mediator.Result`1";
170170
public const string HandlerResult = "Foundatio.Mediator.HandlerResult";
171171
public const string IgnoreAttribute = "Foundatio.Mediator.FoundatioIgnoreAttribute";
172-
public const string HandlerAttribute = "Foundatio.Mediator.FoundatioHandlerAttribute";
172+
public const string HandlerAttribute = "Foundatio.Mediator.HandlerAttribute";
173173
public const string CancellationToken = "System.Threading.CancellationToken";
174174
}

tests/Foundatio.Mediator.Tests/BasicHandlerGenerationTests.GeneratesWrapperForSimpleHandler.verified.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ using System.Diagnostics.CodeAnalysis;
135135
using System.Threading;
136136
using System.Threading.Tasks;
137137

138-
[assembly: Foundatio.Mediator.FoundatioHandlerModule]
138+
[assembly: Foundatio.Mediator.FoundatioModule]
139139

140140
namespace Foundatio.Mediator;
141141

0 commit comments

Comments
 (0)