添加命令数据验证和其他杂项修改
This commit is contained in:
@@ -9,7 +9,7 @@ namespace Domain.AggregateModel.AppAggregate
|
||||
{
|
||||
public interface IAppRepository:IRepository<App>
|
||||
{
|
||||
void Add(App app);
|
||||
App Add(App app);
|
||||
Task<App> GetAsync(int id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Domain.AggregateModel.LinkAggregate
|
||||
{
|
||||
public interface ILinkRepository:IRepository<Link>
|
||||
{
|
||||
void Add(Link link);
|
||||
Link Add(Link link);
|
||||
|
||||
Task<Link> GetAsync(string shortCode);
|
||||
}
|
||||
|
||||
@@ -9,9 +9,4 @@
|
||||
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="9.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Events\" />
|
||||
<Folder Include="Exceptions\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
21
Domain/Events/AppBaseUrlUpdatedDomainEvent.cs
Normal file
21
Domain/Events/AppBaseUrlUpdatedDomainEvent.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Domain.AggregateModel.AppAggregate;
|
||||
using MediatR;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Domain.Events
|
||||
{
|
||||
//更新了基础地址
|
||||
public class AppBaseUrlUpdatedDomainEvent: INotification
|
||||
{
|
||||
public App App { get; set; }
|
||||
public string OldBaseUrl { get; set; }
|
||||
public AppBaseUrlUpdatedDomainEvent(App app,string oldBaseUrl) {
|
||||
App = app;
|
||||
OldBaseUrl = oldBaseUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
Domain/Events/LinkCreatedDomainEvent.cs
Normal file
21
Domain/Events/LinkCreatedDomainEvent.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Domain.AggregateModel.LinkAggregate;
|
||||
using MediatR;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Domain.Events
|
||||
{
|
||||
//短链接生成通知
|
||||
public class LinkCreatedDomainEvent:INotification
|
||||
{
|
||||
public Link Link { get; set; }
|
||||
|
||||
public LinkCreatedDomainEvent(Link link)
|
||||
{
|
||||
Link = link;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Domain/Exceptions/DomainException.cs
Normal file
13
Domain/Exceptions/DomainException.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace Domain.Exceptions
|
||||
{
|
||||
public class DomainException : Exception
|
||||
{
|
||||
public DomainException(string message) : base(message)
|
||||
{ }
|
||||
|
||||
public DomainException(string message, Exception innerException) : base(message, innerException)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user