Skip to content

Commit

Permalink
Merge pull request #63 from netcorepal/features-IntegeraionConvert/ji…
Browse files Browse the repository at this point in the history
…anglei

feat: 修改代码生成器,修改domainEvent命名空间为global::{Namespace}.{Name}
  • Loading branch information
witskeeper authored Sep 2, 2024
2 parents c008f5e + 41e077c commit e71698a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private void Generate(GeneratorExecutionContext context, INamedTypeSymbol integr
}

var domainEvent = iinterface.TypeArguments[0].Name;
var domainEventNameSpace = iinterface.TypeArguments[0].ContainingNamespace.ToString();

string source = $@"// <auto-generated/>
using {convertNamespace};
Expand All @@ -78,14 +79,14 @@ namespace {usingNamespace}.DomainEventHandlers
/// {className}DomainEventHandlers
/// </summary>
public class {className}DomainEventHandler(IIntegrationEventPublisher integrationEventPublisher,
{className} converter) : IDomainEventHandler<{domainEvent}>
{className} converter) : IDomainEventHandler<global::{domainEventNameSpace}.{domainEvent}>
{{
/// <summary>
/// {className}DomainEventHandler
/// </summary>
/// <param name=""notification"">notification</param>
/// <param name=""cancellationToken"">cancellationToken</param>
public async Task Handle({domainEvent} notification, CancellationToken cancellationToken){{
public async Task Handle(global::{domainEventNameSpace}.{domainEvent} notification, CancellationToken cancellationToken){{
// 转移操作发出集成事件
var integrationEvent = converter.Convert(notification);
await integrationEventPublisher.PublishAsync(integrationEvent, cancellationToken);
Expand Down

0 comments on commit e71698a

Please sign in to comment.