Skip to content

Instantly share code, notes, and snippets.

@JonathanLoscalzo
Last active June 18, 2018 02:02
Show Gist options
  • Save JonathanLoscalzo/31bb715b9d3e0f3c814d55ec54a4767e to your computer and use it in GitHub Desktop.
Save JonathanLoscalzo/31bb715b9d3e0f3c814d55ec54a4767e to your computer and use it in GitHub Desktop.
DDD - Domain Service example
public abstract class BaseEntity
{
public int Id { get; set; }
}
public class ToDoEntity : BaseEntity
{
public int Id { get; set; }
/* some fields and properties*/
}
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;
}
}
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