Skip to content

How to create Application Service

marektihkan edited this page Sep 13, 2010 · 1 revision

Workflow

  1. Create__Application Service__ interface to Core.(BoundedContext).Services namespace
  2. Create implementation to Services namespace
  3. Register Application Service to Service Locator if needed

Remarks

  • Use constructor for dependencies

Example


namespace ExampleSolution.Core.Parties.Services
{
    public interface IAuthenticationService
    {
        Account Register(Person person);
        Account Authenticate(string username, string hash);
        void Disable(Account account);
        void Enable(Account account);
    } 
}

namespace ExampleSolution.Services
{
    public class AuthenticationService : IAuthenticationService
    {
        public AuthenticationService(IRegistationService registration, IAuthenticationTask authentication, ILogger logger)
        {
            //...
        }


        public Account Register(Person person) 
        {
            //...
        }

        Account Authenticate(string username, string hash);
        {
            //...
        }

        void Disable(Account account);
        {
            //...
        }

        void Enable(Account account);
        {
            //...
        }
    } 
}