Exemplo n.º 1
0
        public async Task <JsonResult> Index(string t)
        {
            List <AutocompleteRecord> results = new List <AutocompleteRecord>();

            // Query the autocomplete database
            using (CassandraDriver autocompleteDriver = new CassandraDriver())
            {
                results = await autocompleteDriver.SearchAsync(t);
            }

            return(Json(results, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public void CassandraDriver_works()
        {
            if (!TestContext.AppVeyor)
            {
                string originalCurrentDirectory = Directory.GetCurrentDirectory();

                try
                {
                    Directory.SetCurrentDirectory(TestContext.IntegrationTestCassandraFolder);
                    var driver = new CassandraDriver();
                    var cnn    = driver.CreateConnection(_cassandraFixture.CnxStr);
                    cnn.Open();

                    Assert.True(cnn.State == ConnectionState.Open);
                }
                finally
                {
                    Directory.SetCurrentDirectory(originalCurrentDirectory);
                }
            }
        }
Exemplo n.º 3
0
        private static List <BasicNodeModel> MapData(List <BasicNodeModel> list)
        {
            List <BasicNodeModel>     resultingList = new List <BasicNodeModel>();
            Dictionary <string, Guid> nodeMap       = new Dictionary <string, Guid>();

            // Get the currently existing data values
            using (CassandraDriver driver = new CassandraDriver())
            {
                ExistingRecords = driver.AggregateExistingRecords();
            }
            foreach (AutocompleteRecord record in ExistingRecords)
            {
                nodeMap.Add(record.CommonName.ToLowerInvariant(), Guid.Parse(record.Id));
            }

            // For each of the nodes in the node list
            foreach (BasicNodeModel model in list)
            {
                // Map the node
                if (MapNode(model, ref nodeMap))
                {
                    resultingList.Add(model);
                }
            }

            LogInColor("\n===== Mapping Complete =====\n", ConsoleColor.Yellow);
            Console.WriteLine("The following nodes will be added or referenced:");
            foreach (BasicNodeModel n in resultingList)
            {
                LogInColor($"{n.CommonName}", ConsoleColor.Blue);
                foreach (RelationshipModel m in n.Relationships)
                {
                    LogInColor($"\t{m.TargetName}", ConsoleColor.DarkMagenta);
                }
            }
            LogInColor($"\nA total of {resultingList.Count} nodes will be added.\n", ConsoleColor.Cyan);

            return(resultingList);
        }