Exemplo n.º 1
0
        /// <summary>
        /// Loading WCF services plugins by MEF container
        /// </summary>
        /// <param name="container"></param>
        public void LoadServices(CompositionContainer container)
        {
            _logger.TraceMethod(MethodBase.GetCurrentMethod());

            try
            {
                foreach (var service in Services)
                {
                    try
                    {
                        RouteTable.Routes.Add(new ServiceRoute(service.BaseRoute,
                                                               new DI.DependencyInjectionServiceHostFactory(), service.GetType()));
                    }
                    catch (Exception ex)
                    {
                        _logger.Error(ex, string.Format("Error during adding {0} to route {1}", service.GetType().Name, service.BaseRoute));
                    }
                }

                RouteTable.Routes.Add(new ServiceRoute("",
                                                       new DI.DependencyInjectionServiceHostFactory(), typeof(HelpService)));
            }
            catch (Exception ex)
            {
                _logger.ErrorMethod(ex, MethodBase.GetCurrentMethod());
            }
            finally
            {
                _logger.TraceMethodResult(MethodBase.GetCurrentMethod());
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add error log
        /// </summary>
        /// <param name="dto">Client info to logging</param>
        public void Error(LogDTO dto)
        {
            string message = PrepareMessage(dto);

            _logger.Error(message);
        }