Ejemplo n.º 1
0
        public override void ImportData(Data.IAssembler assembler)
        {
            IDatabase     cache = connectionMultiplexer.GetDatabase();
            List <object> data  = assembler.GetData();

            cache.StringSet("airlines", data.Select(d => JsonConvert.SerializeObject(d)).ToString());
        }
        public override void ImportData(Data.IAssembler assembler)
        {
            var manager = new RedisManagerPool("localhost:6379");

            using (var client = manager.GetClient())
            {
                List <object> data = assembler.GetData();
                client.AddRangeToList("airlines", data.Select(d => JsonConvert.SerializeObject(d)).ToList());
            }
        }
        private void GenerateData()
        {
            dataFactory = new Data.DataFactory();

            assembler = dataFactory.GetAssembler("city");
            Data.Importers.AImporter importer = new Data.Importers.CityImporter(connectionMultiplexer);
            importer.ImportData(assembler);

            assembler = dataFactory.GetAssembler("airline");
            importer  = new Data.Importers.AirlineImporter(connectionMultiplexer);
            importer.ImportData(assembler);

            assembler = dataFactory.GetAssembler("schedule");
            importer  = new Data.Importers.ScheduleImporter(connectionMultiplexer);
            importer.ImportData(assembler);
        }
        public override void ImportData(Data.IAssembler assembler)
        {
            IDatabase     cache = connectionMultiplexer.GetDatabase();
            List <object> data  = assembler.GetData();

            for (int iCounter = 0; iCounter < data.Count; iCounter++)
            {
                if (data[iCounter] is Arrival arrival)
                {
                    cache.StringSet("arrivals", JsonConvert.SerializeObject(arrival));
                }
                else if (data[iCounter] is Departure departure)
                {
                    cache.StringSet("departures", JsonConvert.SerializeObject(departure));
                }
            }
        }
Ejemplo n.º 5
0
        public override void ImportData(Data.IAssembler assembler)
        {
            var manager = new RedisManagerPool("localhost:6379");

            using (var client = manager.GetClient())
            {
                List <object> data = assembler.GetData();

                for (int iCounter = 0; iCounter < data.Count; iCounter++)
                {
                    if (data[iCounter] is Arrival arrival)
                    {
                        client.AddItemToList("arrivals", JsonConvert.SerializeObject(arrival));
                    }
                    else if (data[iCounter] is Departure departure)
                    {
                        client.AddItemToList("departures", JsonConvert.SerializeObject(departure));
                    }
                }
            }
        }
        public void ImportData(Data.IAssembler assembler)
        {
            var manager = new RedisManagerPool("localhost:6379");

            using (var client = manager.GetClient())
            {
//                assembler.


                //client.set("foo2", "bar2");
                //console.writeline("foo2={0}", client.get<string>("foo2"));

                //int iCounter = 0;
                //string[] dataTableNames = new string[_metaDataDTO.Data.Count];
                //_metaDataDTO.Data.ForEach(
                //    dataTable => {
                //        dataTableNames[iCounter] = dataTable.Rows[0][0].ToString();
                //        iCounter++;
                //    }
                //);

                //Dictionary<string, string> serializedData = new Dictionary<string, string>();

                //for (iCounter = 0; iCounter < _metaDataDTO.Data.Count; iCounter++)
                //{
                //    serializedData = SerializeData(_metaDataDTO.Data[iCounter]);

                //    HashEntry[] hashEntries = serializedData.Select(sd =>
                //    {
                //        return new HashEntry(sd.Key, sd.Value);
                //    }).ToArray();
                //    HashSet<HashEntry> hashSet = new HashSet<HashEntry>(hashEntries);

                //    client.Set(dataTableNames[iCounter], hashSet);
                //}
            }
        }
 public virtual void ImportData(Data.IAssembler assembler)
 {
 }