ProviderServices.cs

Version InfoThis topic applies to Episerver.ConnectForMarketingAutomation 4.0.0 and lower. For later versions, see Sample Connector - IMarketingConnector

using System;
using EPiServer.MarketingAutomationIntegration.Core;
using EPiServer.MarketingAutomationIntegration.Services;

namespace DemoConnector.Services
{
    /// <summary>
    /// The main interface that provides the service implementations to the marketing automation interfcae (MAI) framework.
    /// Typically, any interface that you do not want to support must have an implementation.
    /// However, you can have every method simply throw NotImplementedException.
    /// </summary>
    public class ProviderServices : IProviderServices
    {
        private IListService    _listService;
        private IProfileService _profileService;
        private IProgramService _programService;
        private IScoringService _scoringService;

        /// <summary>
        /// Not used by MAI; OK to throw NotImplementedException, unless your specific 
        /// implementation can use it.
        /// </summary>
        public IAuthenticationService AuthenticationService
        {
            get
            {   // this method is not used by MAI at all, it is specifically intended as 
                // a helper method for some internal connectors
                throw new NotImplementedException();
            }
        }

        /// <summary>
        /// Returns the IListService to the MAI framework.
        /// </summary>
        public IListService ListService
        {
            get
            {
                if (_listService == null)
                    _listService = new ListService();
                return _listService;
            }
        }

        /// <summary>
        /// Returns the IProfileService to the MAI framework.
        /// </summary>
        public IProfileService ProfileService
        {
            get
            {
                if (_profileService == null)
                    _profileService = new ProfileService();
                return _profileService;
            }
        }

        /// <summary>
        /// Returns the IProgramService to the MAI framework.
        /// </summary>
        public IProgramService ProgramService
        {
            get
            {
                if (_programService == null)
                    _programService = new ProgramService();
                return _programService;
            }
        }

        /// <summary>
        /// Returns the IScoringService to the MAI framework.
        /// </summary>
        public IScoringService ScoringService
        {
            get
            {
                if (_scoringService == null)
                    _scoringService = new ScoringService();
                return _scoringService;
            }
        }
    }
}

Related topics

Last updated: Dec 14, 2015