Пример #1
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);
			};
		}
		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);
		}