Exemple #1
0
        /// <summary>
        /// Henter alle postnumre.
        /// </summary>
        /// <returns>Liste af postnumre.</returns>
        public IEnumerable <Postnummer> PostnummerGetAll()
        {
            var channel = _channelFactory.CreateChannel <IAdresseRepositoryService>(EndpointConfigurationName);

            try
            {
                var query           = new PostnummerGetAllQuery();
                var postnummerViews = channel.PostnummerGetAll(query);
                return(_domainObjectBuilder.BuildMany <PostnummerView, Postnummer>(postnummerViews));
            }
            catch (IntranetRepositoryException)
            {
                throw;
            }
            catch (FaultException ex)
            {
                throw new IntranetRepositoryException(ex.Message);
            }
            catch (Exception ex)
            {
                throw new IntranetRepositoryException(
                          Resource.GetExceptionMessage(ExceptionMessage.RepositoryError, MethodBase.GetCurrentMethod().Name,
                                                       ex.Message), ex);
            }
            finally
            {
                ChannelTools.CloseChannel(channel);
            }
        }
Exemple #2
0
        /// <summary>
        /// Udfører forespørgelse.
        /// </summary>
        /// <param name="query">Forespørgelse efter alle postnumre.</param>
        /// <returns>Alle postnumre.</returns>
        public IEnumerable <PostnummerView> Query(PostnummerGetAllQuery query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }
            var postnumre = _adresseRepository.PostnummerGetAll();

            return(_objectMapper.Map <IEnumerable <Postnummer>, IEnumerable <PostnummerView> >(postnumre));
        }
 public IEnumerable <PostnummerView> PostnummerGetAll(PostnummerGetAllQuery postnummerGetAllQuery)
 {
     try
     {
         return(_queryBus.Query <PostnummerGetAllQuery, IEnumerable <PostnummerView> >(postnummerGetAllQuery));
     }
     catch (Exception ex)
     {
         throw CreateFault(MethodBase.GetCurrentMethod(), ex,
                           int.Parse(Properties.Resources.EventLogAdresseRepositoryService));
     }
 }