Beispiel #1
0
        public void Start()
        {
            bool isRegistered = Registrator.Register((s, e) => TryRegistering());

            if (!isRegistered)
            {
                TryRegistering();
            }
        }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var connectionString = Configuration.GetConnectionString("DefaultConnection");

            Console.WriteLine($"--> Database connection string: {connectionString}");
            Console.WriteLine($"--> Environment: {_env.EnvironmentName}");

            services.AddDbContext <DataContext>(x => x.UseSqlServer(connectionString));
            services.AddCors();
            services.AddMvc()
            .AddJsonOptions(opt =>
                            opt.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore)
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            Registrator.Register(services);
            services.AddTransient <DataSeed>();
            services.AddAutoMapper();
            services.AddSwaggerDocumentation();
            services.AddSignalR();

            services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
            .AddJwtBearer(options =>
            {
                options.TokenValidationParameters = new TokenValidationParameters
                {
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey         = new SymmetricSecurityKey(Encoding.ASCII.
                                                                        GetBytes(Configuration.GetSection("AppSettings:Token").Value)),
                    ValidateIssuer   = false,
                    ValidateAudience = false
                };
            });
        }
        public static void Seedit(Registrator reg, string jsonData, DBContext context)
        {
            List <Product> products = JsonConvert.DeserializeObject <List <Product> >(jsonData);

            if (!context.Products.Any())
            {
                try
                {
                    context.AddRange(products);
                    var tries = 3;
                    while (tries > 0)
                    {
                        tries -= 1;
                        try
                        {
                            reg.Register(products);
                            context.SaveChanges();
                            return;
                        }
                        catch (Exception ex)
                        {
                            Debug.WriteLine(ex.Message);
                            Task.Delay(5000).Wait();
                        }
                    }
                }
                catch
                {
                    throw;
                }
            }
        }
Beispiel #4
0
        private static IUnityContainer InitContainer()
        {
            IUnityContainer container = new UnityContainer();

            Registrator.Register(container);

            return(container);
        }
        private void RegisterButton_Click(object sender, RoutedEventArgs e)
        {
            string name     = NameTextBox.Text;
            string lastname = LastNameTextBox.Text;
            string login    = LoginTextBox.Text;
            string password = PasswordBox.Password;
            string email    = EmailTextBox.Text;
            string phone    = PhoneNumberTextBox.Text;

            Registrator.Register(name, lastname, login, password, phone, email);
        }
        public static IUnityContainer Init(IUnityContainer container = null)
        {
            if (container == null)
            {
                container = GetEmptyContainer();
            }

            RegisterType <IConfig, EmulatedConfig>(container);
            RegisterType <IWebApi, EmulatedWebApi>(container);

            Registrator.Register(container);

            return(container);
        }
Beispiel #7
0
        public ResolveTest()
        {
            //Registrator new UnityContainer();

            //container.RegisterType<DiskReaderProvider>();

            //container.RegisterType<JsonWriterProvider>();

            //container.RegisterType< DoubleProvider<string, string>>();
            ////container.RegisterType<IProviderBase<string, string>, DoubleProvider<string, string>>();

            //container.RegisterType<IMediatorBase<string, string>, ConcreteMediator<string, string>>();


            //container.RegisterType< ConcreteMediator<string, string>>();

            container = Registrator.Register();
        }
Beispiel #8
0
 ///// <summary>
 ///// Load your modules or register your services here!
 ///// </summary>
 ///// <param name="kernel">The kernel.</param>
 private static void RegisterServices(IKernel kernel)
 {
     Registrator.Register(kernel);
 }
Beispiel #9
0
        public static void InitDDBB()
        {
            OwnLogger.AllLogs.Clear();
            new EmulatedConfig().Clean();

            Mallorca.AddHotel(IdHotelMallorca01);
            Mallorca.AddHotel(IdHotelMallorca02);
            Mallorca.AddHotel(IdHotelMallorca03);
            Mallorca.AddHotel(IdHotelMallorca04);
            Mallorca.AddHotel(IdHotelMallorca05);
            Mallorca.AddHotel(IdHotelMallorca06);
            Mallorca.AddHotel(IdHotelMallorca07);
            Mallorca.AddHotel(IdHotelMallorca08);
            Mallorca.AddHotel(IdHotelMallorca09);
            Mallorca.AddHotel(IdHotelMallorca10);
            Ibiza.AddHotel(IdHotelIbiza01);
            Ibiza.AddHotel(IdHotelIbiza02);
            Ibiza.AddHotel(IdHotelIbiza03);
            Ibiza.AddHotel(IdHotelIbiza04);
            Ibiza.AddHotel(IdHotelIbiza05);
            Ibiza.AddHotel(IdHotelIbiza06);
            Ibiza.AddHotel(IdHotelIbiza07);
            Ibiza.AddHotel(IdHotelIbiza08);
            Ibiza.AddHotel(IdHotelIbiza09);
            Ibiza.AddHotel(IdHotelIbiza10);
            Formentera.AddHotel(IdHotelFormentera01);
            Formentera.AddHotel(IdHotelFormentera02);
            Formentera.AddHotel(IdHotelFormentera03);
            Formentera.AddHotel(IdHotelFormentera04);
            Formentera.AddHotel(IdHotelFormentera05);
            Formentera.AddHotel(IdHotelFormentera06);
            Formentera.AddHotel(IdHotelFormentera07);
            Formentera.AddHotel(IdHotelFormentera08);
            Formentera.AddHotel(IdHotelFormentera09);
            Formentera.AddHotel(IdHotelFormentera10);

            var hotels = new HotelsRepository();

            hotels.Reset();
            hotels.Set(HotelMallorca01);
            hotels.Set(HotelMallorca02);
            hotels.Set(HotelMallorca03);
            hotels.Set(HotelMallorca04);
            hotels.Set(HotelMallorca05);
            hotels.Set(HotelMallorca06);
            hotels.Set(HotelMallorca07);
            hotels.Set(HotelMallorca08);
            hotels.Set(HotelMallorca09);
            hotels.Set(HotelMallorca10);
            hotels.Set(HotelIbiza01);
            hotels.Set(HotelIbiza02);
            hotels.Set(HotelIbiza03);
            hotels.Set(HotelIbiza04);
            hotels.Set(HotelIbiza05);
            hotels.Set(HotelIbiza06);
            hotels.Set(HotelIbiza07);
            hotels.Set(HotelIbiza08);
            hotels.Set(HotelIbiza09);
            hotels.Set(HotelIbiza10);
            hotels.Set(HotelFormentera01);
            hotels.Set(HotelFormentera02);
            hotels.Set(HotelFormentera03);
            hotels.Set(HotelFormentera04);
            hotels.Set(HotelFormentera05);
            hotels.Set(HotelFormentera06);
            hotels.Set(HotelFormentera07);
            hotels.Set(HotelFormentera08);
            hotels.Set(HotelFormentera09);
            hotels.Set(HotelFormentera10);

            var regions = new RegionsRepository();

            regions.Reset();
            regions.Set(Mallorca);
            regions.Set(Ibiza);
            regions.Set(Formentera);

            var types = new HotelTypesRepository();

            types.Reset();
            types.Set(TypeOnlyAdult);
            types.Set(TypeHotelSpa);
            types.Set(TypePremium);

            var clients = new ClientsRepository();

            clients.Reset();
            clients.Set(new Client {
                Id = IdClient01, Email = "*****@*****.**", Name = "Client 01", Telephone = "666666601"
            });
            clients.Get(IdClient01).AddObserver(Mallorca);
            clients.Get(IdClient01).AddObserver(Formentera);
            clients.Get(IdClient01).Preference_A = "Some Value";
            clients.Set(new Client {
                Id = IdClient02, Email = "*****@*****.**", Name = "Client 02", Telephone = "666666602"
            });
            clients.Get(IdClient02).AddObserver(Mallorca);
            clients.Get(IdClient02).AddObserver(Ibiza);
            clients.Get(IdClient02).Preference_A = "Some Value";
            clients.Set(new Client {
                Id = IdClient03, Email = "*****@*****.**", Name = "Client 03", Telephone = "666666603"
            });
            clients.Get(IdClient03).AddObserver(Ibiza);
            clients.Get(IdClient03).AddObserver(Formentera);
            clients.Get(IdClient03).Preference_A = "Some Value";
            clients.Set(new Client {
                Id = IdClient04, Email = "*****@*****.**", Name = "Client 04", Telephone = "666666604"
            });
            clients.Get(IdClient04).AddObserver(Formentera);
            clients.Get(IdClient04).Preference_A = "Some Value";
            clients.Set(new Client {
                Id = IdClient05, Email = "*****@*****.**", Name = "Client 05", Telephone = "666666605"
            });
            clients.Get(IdClient05).AddObserver(Ibiza);
            clients.Get(IdClient05).Preference_A = "Some Value";

            Global.Reset();

            Global.Register <IConfig, EmulatedConfig>();

            Registrator.Register();

            Global.Prepare();
        }
        public static void RegisterRenders()
        {
            Registrator <FrameMesh> .Register <MaterialHitTest, FrameMeshRender <MaterialHitTestEffect> >();

            Registrator <FrameSkin> .Register <MaterialHitTest, FrameSkinRender <MaterialHitSkinneffect> >();
        }