Exemplo n.º 1
0
        public static IBus CreateBus(string rabbitMqConfigName, Action <IServiceRegister> registerServices)
        {
            var container = createContainerInternal();

            ServiceLocator.SetLocatorProvider(CustomUnityContainer.GetConfiguredContainer());

            var connectionConfiguration = GetConnectionConfiguration(rabbitMqConfigName);

            container.Register <IRabbitMqConfiguration>(p => connectionConfiguration);
            container.Register(p => AdvancedBusEventHandlers.Default);
            registerServices(container);
            ComponentRegistration.RegisterServices(container);
            return(container.Resolve <IBus>());
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IList <CustomerDTO> GetCustomerDetails()
        {
            try
            {
                if (HandleHttpOptionsRequest())
                {
                    IList <CustomerDTO> CustomerList = CustomUnityContainer.Resolve <ICustomerService>().GetCustomers();
                    return(CustomerList.Count > 0 ? CustomerList : null);
                }
            }
            catch (DbEntityValidationException ex)
            {
                // Retrieve the error messages as a list of strings.
                var errorMessages = ex.EntityValidationErrors
                                    .SelectMany(x => x.ValidationErrors)
                                    .Select(x => x.ErrorMessage);

                // Join the list to a single string.
                var fullErrorMessage = string.Join("; ", errorMessages);

                // Combine the original exception message with the new one.
                var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage);

                // Throw a new DbEntityValidationException with the improved exception message.
                throw new DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors);
            }
            catch (InvalidOperationException ex)
            {
                //throw ex;
            }
            catch (Exception ex)
            {
            }


            return(null);
        }
Exemplo n.º 3
0
 public DashBoardViewModel()
 {
     _objDashboardManager = CustomUnityContainer.Resolve <IDashboardManager>();
     GetSalesReport();
     GetProductList();
 }