Last active
June 18, 2018 02:02
-
-
Save JonathanLoscalzo/31bb715b9d3e0f3c814d55ec54a4767e to your computer and use it in GitHub Desktop.
DDD - Domain Service example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class BaseEntity | |
{ | |
public int Id { get; set; } | |
} | |
public class ToDoEntity : BaseEntity | |
{ | |
public int Id { get; set; } | |
/* some fields and properties*/ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public GetLastModifiedTodoItemResponse : IHandleResponse | |
{ | |
ICollection<ToDoEntity> latestItems; | |
} | |
public GetLastModifiedTodoItemRequest : IHandleRequest | |
{ | |
/* some search parameters, or something like that */ | |
} | |
public class GetLastModifiedToDoItemsService : IHandle<IHandleRequest, IHandleResponse> | |
{ | |
public GetLastModifiedTodoItemResponse Handle(GetLastModifiedTodoItemRequest request) | |
{ | |
/*some code*/ | |
return response; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IHandlerRequest { } | |
public interface IHandlerResponse { } | |
public interface IHandle<T,G> where T:IHandlerRequest, G:IHandlerResponse | |
{ | |
IHandlerResponse Handle(IHandlerRequest request); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment