Exemple #1
0
 public void DeleteReview(Category category, Guid id)
 {
     using (var context = new DynamoDBContext(_dbClient, _dbOperationConfig))
     {
         context.Delete <Review>(category, id);
     }
 }
Exemple #2
0
 public void DeleteReview(Review review)
 {
     using (var context = new DynamoDBContext(_dbClient, _dbOperationConfig))
     {
         context.Delete(review);
     }
 }
Exemple #3
0
        public static void CleanSession()
        {
            Logger.DebugFormat("Removing {0} records from DynamoDb", _recordsForCleanup.Count);

            Parallel.ForEach(_recordsForCleanup, book => PersistenceContext.Delete(book));

            _recordsForCleanup = new ConcurrentQueue <Book>();
        }
        public void Delete(string id)
        {
            Widget original = _context.Load <Widget>(id);

            if (original != null)
            {
                _context.Delete <Widget>(original);
            }
        }
Exemple #5
0
        public void Delete(string id)
        {
            Type original = _context.Load <Type>(id);

            if (original != null)
            {
                _context.Delete <Type>(original);
            }
        }
Exemple #6
0
        /// <summary>
        /// Deletes an Item from the table.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="item"></param>
        public void DeleteItem <T>(T item)
        {
            var savedItem = DbContext.Load(item);

            if (savedItem == null)
            {
                throw new AmazonDynamoDBException("The item does not exist in the Table");
            }

            DbContext.Delete(item);
        }
Exemple #7
0
        public static void DeleteCity(DynamoDBContext context, String cidadeDestinatario, String id)
        {
            Console.WriteLine("Criando Cidades");
            Cidades cidades = new Cidades
            {
                cidadeDestinatario = cidadeDestinatario.ToLower(),
                id = id.ToLower(),
            };

            Console.WriteLine("Salvando Ordem de Servico");
            context.Delete <Cidades>(cidades);
        }
Exemple #8
0
        public static void DeleteEmployer(DynamoDBContext context, String id, String nome)
        {
            Console.WriteLine("Apagando Funcionario");
            Funcionarios funcionario = new Funcionarios
            {
                id   = id.ToLower(),
                nome = nome.ToLower()
            };

            context.Delete <Funcionarios>(funcionario);
            Console.WriteLine("Funcionário Apagado");
        }
Exemple #9
0
        public void DeleteItem <T>(T item)
        {
            dbContext = CreateDynamoDBContext();
            T savedItem = dbContext.Load(item);

            if (savedItem == null)
            {
                throw new AmazonDynamoDBException("Item does not exist in the Table");
            }

            dbContext.Delete(savedItem);
        }
Exemple #10
0
        public static void DeleteBook(this DynamoDBContext context, int sampleBookId)
        {
            Console.WriteLine("\n*** Executing DeleteBook() ***");
            // Optional configuration.
            var config = new DeleteItemOperationConfig
            {
                // Return the deleted item.
                ReturnValues = ReturnValues.AllOldAttributes
            };

            context.Delete <Book>(sampleBookId, config);
            Console.WriteLine("DeleteBook: Printing deleted just deleted...");
        }
Exemple #11
0
        public void Delete <T>(string key, string range)
        {
            using (DynamoDBContext context = new DynamoDBContext(_client, _conf))
            {
                var savedItem = context.Load <T>(key, range);

                if (savedItem == null)
                {
                    throw new IdentityException("The item does not exist in the Table");
                }

                context.Delete(savedItem);
            }
        }
Exemple #12
0
        public static void deleteJob(DynamoDBContext context, String xml, String id, String nomeDestinatario, String enderecoDestinatario, String destinatario, String status)
        {
            Console.WriteLine("Deletando ordem de serviço");
            Servicos servicos = new Servicos
            {
                xml = xml.ToLower(),
                id  = id.ToLower(),
                nomeDestinatario     = nomeDestinatario.ToLower(),
                enderecoDestinatario = enderecoDestinatario.ToLower(),
                cidadeDestinatario   = destinatario.ToLower(),
                status = status.ToLower(),
            };

            context.Delete <Servicos>(servicos);
        }
Exemple #13
0
        public static void DeleteUser(DynamoDBContext context, String user)
        {
            Console.WriteLine("Deletando Usuario");
            Login login = new Login
            {
                user = user.ToLower(),
            };

            if (user.ToLower() != "admin")
            {
                Console.WriteLine("Deletando usuario");
                context.Delete <Login>(login);
            }
            else
            {
                Console.WriteLine("Não é possível deletar o administrador do Sistema");
            }
        }
        private static void TestCRUDOperations(DynamoDBContext context)
        {
            int  bookID = 1001; // Some unique value.
            Book myBook = new Book
            {
                Id          = bookID,
                Title       = "object persistence-AWS SDK for.NET SDK-Book 1001",
                ISBN        = "111-1111111001",
                BookAuthors = new List <string> {
                    "Author 1", "Author 2"
                },
            };

            // Save the book.
            context.Save(myBook);
            // Retrieve the book.
            Book bookRetrieved = context.Load <Book>(bookID);

            // Update few properties.
            bookRetrieved.ISBN        = "222-2222221001";
            bookRetrieved.BookAuthors = new List <string> {
                " Author 1", "Author x"
            };                                                                        // Replace existing authors list with this.
            context.Save(bookRetrieved);

            // Retrieve the updated book. This time add the optional ConsistentRead parameter using DynamoDBContextConfig object.
            Book updatedBook = context.Load <Book>(bookID, new DynamoDBContextConfig
            {
                ConsistentRead = true
            });

            // Delete the book.
            context.Delete <Book>(bookID);
            // Try to retrieve deleted book. It should return null.
            Book deletedBook = context.Load <Book>(bookID, new DynamoDBContextConfig
            {
                ConsistentRead = true
            });

            if (deletedBook == null)
            {
                Console.WriteLine("Book is deleted");
            }
        }
        public bool DeleteDocumentRecord(DocumentEntity document)
        {
            bool status = true;

            SetDynamoDBClient();

            DynamoDBContext context = new DynamoDBContext(DynamoClient);

            try
            {
                context.Delete <DocumentEntity>(document);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(status);
        }
Exemple #16
0
        void DeleteItem(AmazonDynamoDBClient client, int year, string title)
        {
            try
            {
                var table = GetTableObject(client, "Movies");
                if (table == null)
                {
                    return;
                }

                DynamoDBContext context = new DynamoDBContext(client);
                var             movie   = new Movies();
                movie.year  = year;
                movie.title = title;

                context.Delete <Movies>(movie);
                Console.WriteLine("\nItem Deleted");
            }
            catch (Exception ex)
            {
                Console.WriteLine("\n Error: failed to delete data; " + ex.Message);
            }
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();


			var client = new AmazonDynamoDBClient(ACCESS_KEY, SECRET_KEY, Amazon.RegionEndpoint.USEast1);
			var context = new DynamoDBContext(client);

			var actor = new Actor("John Doe");
			context.Save(actor);

			actor = context.Load<Actor>("John Doe");
			actor.Biography = "Current email: [email protected]";
			context.Save(actor);

			context.Delete(actor);

			var movie = new Movie("Casablanca", new DateTime(1943, 1, 23));
			context.Save(movie);

			movie = context.Load<Movie>("Casablanca", new DateTime(1943, 1, 23));
			movie.Genres = new List<string> { "Drama", "Romance", "War" };
			context.Save(movie);

			DateTime date = new DateTime(1960, 1, 1);
			var queryResults = context.Query<Movie>("Casablanca", QueryOperator.LessThan, date).ToList ();

			foreach (var result in queryResults)
				Console.WriteLine(result.Title);
		}
Exemple #18
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			// Get our button from the layout resource,
			// and attach an event to it
			Button button = FindViewById<Button> (Resource.Id.myButton);
			
			button.Click += delegate
			{
				var client = new AmazonDynamoDBClient(ACCESS_KEY, SECRET_KEY, Amazon.RegionEndpoint.USEast1);
				var context = new DynamoDBContext(client);

				var actor = new Actor("John Doe");
				context.Save(actor);

				actor = context.Load<Actor>("John Doe");
				actor.Biography = "Current email: [email protected]";
				context.Save(actor);

				context.Delete(actor);

				var movie = new Movie("Casablanca", new DateTime(1943, 1, 23));
				context.Save(movie);

				movie = context.Load<Movie>("Casablanca", new DateTime(1943, 1, 23));
				movie.Genres = new List<string> { "Drama", "Romance", "War" };
				context.Save(movie);

				DateTime date = new DateTime(1960, 1, 1);
				var queryResults = context.Query<Movie>("Casablanca", QueryOperator.LessThan, date).ToList ();

				foreach (var result in queryResults)
					Console.WriteLine(result.Title);
			};
		}
Exemple #19
0
 public void DeleteRow <T>(string key, DynamoDBOperationConfig operationConfig)
 {
     _context.Delete <T>(key, operationConfig);
 }
 public bool Delete <K>(K id)
 {
     _DbContext.Delete <T>(id);
     return(_DbContext.Load <T>(id) == null);
 }