コード例 #1
0
        public override Notification Map(NotificationEntity objectToMap)
        {
            var notificationMedia = _notificationMediumRepository.GetAll().ToList();
            NotificationMedium notificationMedium = notificationMedia.FirstOrDefault(nm => nm.Id == objectToMap.NotificationMediumId);

            if (notificationMedium != null)
            {
                switch (notificationMedium.Medium)
                {
                case NotificationMediumType.EmailNotification:
                    return(MapNotificationEmail(objectToMap));

                case NotificationMediumType.PhoneNotification:
                case NotificationMediumType.SmsNotification:
                case NotificationMediumType.FaxNotification:
                    return(MapNotificationPhone(objectToMap));
                }
            }
            else
            {
                throw new NotSupportedException();
                // Log that the notification medium was not found...
            }
            var notification = new Notification(objectToMap.NotificationId);

            _notificationPopulator.Populate(objectToMap, notification);
            return(notification);
        }
        /// <summary>
        ///     Populate <paramref name="container" />
        /// </summary>
        /// <param name="container"><see cref="Unity.IUnityContainer" /> to register types</param>
        /// <returns>
        ///     <paramref name="container" />
        /// </returns>
        public IUnityContainer Populate([NotNull] IUnityContainer container)
        {
            IDictionary <Type, IList <Type> > annotatedTypes = FindAnnotatedTypes(TypeDefined.Inherit);

            typePopulator.Populate(container, annotatedTypes[typeof(RegisterTypeAttribute)]);
            instancePopulator.Populate(container, annotatedTypes[typeof(RegisterProviderAttribute)]);
            factoryPopulator.Populate(container, annotatedTypes[typeof(RegisterProviderAttribute)]);

            return(container);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: skiwheelr/KarveCar
        static void Main(string[] args)
        {
            var        populate     = PopulateFactory.GetInstance();
            IPopulator brokerVisits = populate.BuildBrokerVisits();

            try
            {
                brokerVisits.Populate();
                Console.WriteLine("Press a key to confirm..");
                Console.ReadLine();
            } catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #4
0
        /// <summary>
        ///     Populate <paramref name="container" />
        /// </summary>
        /// <param name="container"><see cref="Unity.IUnityContainer" /> to register types</param>
        /// <returns>
        ///     <paramref name="container" />
        /// </returns>
        public IUnityContainer Populate([NotNull] IUnityContainer container)
        {
            TypePopulator.Populate(container);

            return(container);
        }