Exemplo n.º 1
0
        public void RunCRUD()
        {
            //Insert Record
            User user = new User()
            {
                FirstName = "Caner",
                LastName  = "LastName2",
                Address   = new Address()
                {
                    City          = "Istanbul",
                    State         = "Avrupa",
                    StreetAddress = "101 ok",
                    ZipCode       = "12345"
                }
            };
            RecordInserter recordInserter = new RecordInserter(_db);

            recordInserter.InsertOne("Users", user);

            //Read Record
            RecordReader recordReader = new RecordReader(_db);
            List <User>  userList     = recordReader.LoadRecords <User>("Users");

            foreach (var oneUser in userList)
            {
                Console.WriteLine($"{oneUser.Id}, {oneUser.FirstName}, {oneUser.LastName}");
                if (oneUser.Address != null)
                {
                    Console.WriteLine(oneUser.Address.City);
                }

                Console.WriteLine();
            }

            //Read Record by id
            var recordById = recordReader.LoadRecordById <User>("Users", new Guid(""));
        }