コード例 #1
0
        /// <summary>
        /// Deleting Test2 table
        /// </summary>
        private static void DeleteTest2()
        {
            var request = new CrystallizeBackendLib.Request<object>("Test2");

            var response = request.DeleteTable();

            if (response.ok == false)
            {
                Console.WriteLine("Delete table test 2 failed : " + response.message);
            }
        }
コード例 #2
0
        /// <summary>
        /// Table creation with user settings
        /// </summary>
        private static void AddTest2()
        {
            var request = new CrystallizeBackendLib.Request<object>("Test2");

            var response = request.AddTable(keyName:"ID", keyType:CrystallizeBackendLib.TableKeyType.Integer, writeThroughput:3, readThroughput:3);

            if (response.ok == false)
            {
                Console.WriteLine("Add table test 2 failed : " + response.message);
            }
        }
コード例 #3
0
        /// <summary>
        /// Table creation with default settings
        /// </summary>
        private static void AddTest1()
        {
            var request = new CrystallizeBackendLib.Request<object>("Test");

            var response = request.AddTable();

            if (response.ok == false)
            {
                Console.WriteLine("Add table test 1 failed : " + response.message);
            }
        }
コード例 #4
0
        /// <summary>
        /// Deleting an existing entry
        /// </summary>
        private static void DeleteTest1()
        {
            var request = new CrystallizeBackendLib.Request<object>("Test");

            request.ID = "234";

            var response = request.DeleteData();

            if (response.ok == false)
            {
                Console.WriteLine("Delete Test 1 failed : " + response.message);
            }
        }
コード例 #5
0
        /// <summary>
        /// Save simple object
        /// </summary>
        private static void SaveTest1()
        {
            var person = new Person() { Age = 25, Name = new FullName() { Firstname = "Ravi", Lastname = "Dugar" } };

            var request = new CrystallizeBackendLib.Request<Person>("Test");

            request.ID = "234";

            var response = request.SaveData(person);

            if (response.ok == false)
            {
                Console.WriteLine("Save Test 1 failed : " + response.message);
            }
        }
コード例 #6
0
        /// <summary>
        /// Insert complex object with list
        /// </summary>
        private static void SaveTest2()
        {
            var person = new Person1() { Age = 30, Name = new FullName() { Firstname = "Ravi", Lastname = "Dugar" }, CollegeName = new List<string>() };

            person.CollegeName.Add("Cornell University");

            var request = new CrystallizeBackendLib.Request<Person>("Test");

            request.ID = "236";

            var response = request.SaveData(person);

            if (response.ok == false)
            {
                Console.WriteLine("Save Test 2 failed : " + response.message);
            }
        }
コード例 #7
0
        /// <summary>
        /// Query for single entry
        /// </summary>
        private static void GetTest1()
        {
            var request = new CrystallizeBackendLib.Request<Person>("Test");

            request.AddQuery("Age", CrystallizeBackendLib.Operator.EQ, 25);

            var response = request.GetData();

            if (response.ok == true && response.results.Count > 0)
            {
                Console.WriteLine("Result : " + response.result.Name.Firstname + " " + response.result.Name.Lastname + " " + response.result.Age);
            }
            else
            {
                Console.WriteLine("Query test 1 failed : " + response.message);
            }
        }
コード例 #8
0
        /// <summary>
        /// Query with filters
        /// </summary>
        private static void GetTest3()
        {
            var request = new CrystallizeBackendLib.Request<Person1>("Test");

            request.AddQuery("Age", CrystallizeBackendLib.Operator.EQ, 30);

            request.AddFilter("Name.FirstName", "Age");

            var response = request.GetData();

            if (response.ok == true && response.results.Count > 0 && String.IsNullOrEmpty(response.result.Name.Lastname))
            {
                Console.WriteLine("Result : " + response.result.Name.Firstname + " " + response.result.Age);
            }
            else
            {
                Console.WriteLine("Query test 3 failed : " + response.message);
            }
        }
コード例 #9
0
        /// <summary>
        /// Query for multiple entries
        /// </summary>
        private static void GetTest2()
        {
            var request = new CrystallizeBackendLib.Request<Person>("Test");

            request.AddQuery("Age", CrystallizeBackendLib.Operator.GE, 25);

            var response = request.GetData();

            if (response.ok == true)
            {
                if (response.results.Count == 2)
                {
                    Console.WriteLine("Found all records");
                }
                else
                {
                    Console.WriteLine("Query test 2 failed : " + response.message);
                }
            }
            else
            {
                Console.WriteLine("Query test 2 failed : " + response.message);
            }
        }