OpenSession() public method

public OpenSession ( ) : IDocumentSession
return IDocumentSession
Ejemplo n.º 1
0
		public void CanProfileLazyRequests()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8079" })
			{
				store.Initialize();
				store.InitializeProfiling();
				using (var session = store.OpenSession())
				{
					// handle the initial request for replication information
				}
				Guid id;
				using (var session = store.OpenSession())
				{
					id = ((DocumentSession)session).DatabaseCommands.ProfilingInformation.Id;
					session.Advanced.Lazily.Load<User>("users/1");
					session.Advanced.Lazily.Load<User>("users/2");
					session.Advanced.Lazily.Load<User>("users/3");

					session.Advanced.Eagerly.ExecuteAllPendingLazyOperations();
				}

				var profilingInformation = store.GetProfilingInformationFor(id);
				Assert.Equal(1, profilingInformation.Requests.Count);

				var responses = JsonConvert.DeserializeObject<GetResponse[]>(profilingInformation.Requests[0].Result, Default.Converters);
				Assert.Equal(3, responses.Length);
				foreach (var response in responses)
				{
					Assert.Equal(404, response.Status);
				}

			}
		}
Ejemplo n.º 2
0
		public void CanTrackPosts()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8080" })
			{
				store.Initialize();
				// make the replication check here
				using (var session = store.OpenSession())
				{
					session.Load<User>("users/1");
				}

				Guid id;
				using (var session = store.OpenSession())
				{
					session.Store(new User());
					session.SaveChanges();

					id = session.Advanced.DatabaseCommands.ProfilingInformation.Id;
				}

				var profilingInformation = store.GetProfilingInformationFor(id);

				Assert.Equal(1, profilingInformation.Requests.Count);
			}
		}
Ejemplo n.º 3
0
		public void CanGenerateComplexPaths()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8079" }.Initialize())
			{
				using (var s = store.OpenSession())
				{
					s.Store(new User { Name = "Ayende" });
					s.Store(new User
					{
						Name = "Rahien",
						Friends = new[]
						{
							new DenormalizedReference {Name = "Ayende", Id = "users/1"},
						}
					});

					s.SaveChanges();
				}

				using (var s = store.OpenSession())
				{
					var user = s.Include("Friends,Id").Load<User>("users/2");
					Assert.Equal(1, user.Friends.Length);
					foreach (var denormalizedReference in user.Friends)
					{
						s.Load<User>(denormalizedReference.Id);
					}

					Assert.Equal(1, s.Advanced.NumberOfRequests);
				}
			}
		}
Ejemplo n.º 4
0
        public void CanQueryDefaultDatabaseQuickly()
        {
            using (GetNewServer(8080))
            using (var store = new DocumentStore
            {
                Url = "http://localhost:8080"
            }.Initialize())
            {
                store.DatabaseCommands.EnsureDatabaseExists("Northwind");

                using (var s = store.OpenSession("Northwind"))
                {
                    var entity = new User
                    {
                        Name = "Hello",
                    };
                    s.Store(entity);
                    s.SaveChanges();
                }

                var sp = Stopwatch.StartNew();
                using (var s = store.OpenSession())
                {
                    Assert.Empty(s.Query<User>().Where(x => x.Name == "Hello"));
                }
                Assert.True(TimeSpan.FromSeconds(5) > sp.Elapsed);
            }
        }
Ejemplo n.º 5
0
        public void After_modification_will_get_value_from_server()
        {
            using (GetNewServer())
            using (var store = new DocumentStore { Url = "http://localhost:8080" }.Initialize())
            {
                using (var s = store.OpenSession())
                {
                    s.Store(new User { Name = "Ayende" });
                    s.SaveChanges();
                }

                using (var s = store.OpenSession())
                {
                    s.Load<User>("users/1");
                    s.SaveChanges();
                }

                using (var s = store.OpenSession())
                {
                    var user = s.Load<User>("users/1");
                    user.Name = "Rahien";
                    Assert.Equal(1, HttpJsonRequest.NumberOfCachedRequests);
                    s.SaveChanges();
                }

                using (var s = store.OpenSession())
                {
                    s.Load<User>("users/1");
                    Assert.Equal(1, HttpJsonRequest.NumberOfCachedRequests); // did NOT get from cache
                }
            }
        }
Ejemplo n.º 6
0
		public void Can_read_entity_name_after_update_from_query_after_entity_is_in_cache()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8080" }.Initialize())
			{
				using (var s = store.OpenSession())
				{
					s.Store(new Event { Happy = true });
					s.SaveChanges();
				}

				using (var s = store.OpenSession())
				{
					s.Load<Event>("events/1");//load into cache
				}

				using (var s = store.OpenSession())
				{
					s.Load<Event>("events/1").Happy = false;
					s.SaveChanges();
				}

				using (var s = store.OpenSession())
				{
					var events = s.Query<Event>().Customize(x => x.WaitForNonStaleResults()).ToArray();
					Assert.NotEmpty(events);
				}
			}
		}
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
			var documentStore1 = new DocumentStore { Url = "http://localhost:8080" }.Initialize();

            using (var session1 = documentStore1.OpenSession())
            {
                session1.Store(new User { Id = "users/ayende", Name = "Ayende" });
                session1.SaveChanges();
            }

            using (var session1 = documentStore1.OpenSession())
            {
                Console.WriteLine(session1.Load<User>("users/ayende").Name);
            }

            Console.WriteLine("Wrote one docuemnt to 8080, ready for server failure");

            Console.ReadLine();

            using (var session1 = documentStore1.OpenSession())
            {
                Console.WriteLine(session1.Load<User>("users/ayende").Name);
            }

        }
Ejemplo n.º 8
0
		public void CanUseInclude_Remote()
		{
			using (GetNewServer())
			using (var store = new DocumentStore
			{
				Url = "http://localhost:8079"
			}.Initialize())
			{
				using (var s = store.OpenSession())
				{
					var user = new User { FirstName = "Demo", LastName = "User" };
					s.Store(user);
					var item = new Item(user.Id, "Stuff");
					s.Store(item);
					user.UserItems = new List<UserItem>
					{
						new UserItem
						{
							Item = new ItemReference {Id = item.Id, Summary = item.Summary, UserId = item.UserId},
							Name = "Stuff 2"
						}
					};
					s.SaveChanges();
				}

				using (var s = store.OpenSession())
				{
					var userLookup = s.Include<UserItem>(x => x.Item.Id).Load<User>(1);
					foreach (var uit in userLookup.UserItems)
					{
						var item2 = s.Load<Item>(uit.Item.Id);
					}
				}
			}
		}
Ejemplo n.º 9
0
		public void Can_cache_document_with_includes()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8079" }.Initialize())
			{
				using (var s = store.OpenSession())
				{
					s.Store(new User {Name = "Ayende"});
					s.Store(new User { PartnerId = "users/1"});
					s.SaveChanges();
				}

				using (var s = store.OpenSession())
				{
					s.Include<User>(x=>x.PartnerId)
						.Load("users/2");
					s.SaveChanges();
				}

				using (var s = store.OpenSession())
				{
					s.Include<User>(x => x.PartnerId)
						.Load("users/2");
					Assert.Equal(1, store.JsonRequestFactory.NumberOfCachedRequests);
				}
			}
		}
Ejemplo n.º 10
0
        static void Main()
        {
            using (var store = new DocumentStore
            {
                Url = "https://2.ravenhq.com/databases/ayende-freedb",
                ApiKey = "2cdd2658-1181-4d67-b15e-7adcc48c461a"
            }.Initialize())
            {
                var session = store.OpenSession();
                var count = 0;

                var sp = ParseDisks(diskToAdd =>
                {
                    session.Store(diskToAdd);
                    count += 1;
                    if (count < BatchSize)
                        return;

                    session.SaveChanges();
                    session = store.OpenSession();
                    count = 0;
                });

                session.SaveChanges();

                Console.WriteLine();
                Console.WriteLine("Done in {0}", sp.Elapsed);
            }
        }
Ejemplo n.º 11
0
		public void CanUseMultiGetToBatchGetDocumentRequests()
		{
			using (GetNewServer())
			using (var docStore = new DocumentStore {Url = "http://localhost:8079"}.Initialize())
			{
				for (int i = 0; i < 10; i++)
				{
					string id;
					using (var tx = new TransactionScope())
					using (var session = docStore.OpenSession())
					{

						Transaction.Current.EnlistDurable(ManyDocumentsViaDTC.DummyEnlistmentNotification.Id,
						                                  new ManyDocumentsViaDTC.DummyEnlistmentNotification(), EnlistmentOptions.None);

						var entity = new User { Name = "Ayende" };
						session.Store(entity);
						session.SaveChanges();
						id = entity.Id;
						tx.Complete();
					}

					using (var session = docStore.OpenSession())
					{
						session.Advanced.AllowNonAuthoritativeInformation = false;
						var user = session.Advanced.Lazily.Load<User>(id);
						Assert.NotNull(user.Value);
					}
				}

			}
		}
Ejemplo n.º 12
0
		public void MultiMapIndexes()
		{
			using (var store = new DocumentStore())
			{
				using (var session = store.OpenSession())
				{
					#region multi_map_2
					List<object> results = session
						.Advanced
						.DocumentQuery<object, Animals_ByName>()
						.WhereEquals("Name", "Mitzy")
						.ToList();
					#endregion
				}

				using (var session = store.OpenSession())
				{
					#region multi_map_3
					IList<IAnimal> results = session
						.Query<IAnimal, Animals_ByName>()
						.Where(x => x.Name == "Mitzy")
						.ToList();
					#endregion
				}
			}
		}
Ejemplo n.º 13
0
		public void query_for_object_with_byte_array_with_default_TypeNameHandling()
		{
			using (var server = GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8079" })
			{
				store.Initialize();

				var json = GetResourceText("DocumentWithBytes.txt");
				var jsonSerializer = new DocumentConvention().CreateSerializer();
				var item = jsonSerializer.Deserialize<DesignResources>(new JsonTextReader(new StringReader(json)));

				using (var session = store.OpenSession())
				{
					item.Id = "resources/123";
					item.DesignId = "designs/123";
					session.Store(item);
					session.SaveChanges();
				}

				using (var session = store.OpenSession())
				{
					session
						.Query<DesignResources>()
						.Customize(x => x.WaitForNonStaleResultsAsOfNow())
						.Where(x => x.DesignId == "designs/123")
						.ToList();
				}
			}
		}
Ejemplo n.º 14
0
		public OpeningSession()
		{
			string databaseName = "DB1";

			using (var store = new DocumentStore())
			{
				#region open_session_2
				store.OpenSession(new OpenSessionOptions());
				#endregion

				#region open_session_3
				store.OpenSession(new OpenSessionOptions
									  {
										  Database = databaseName
									  });
				#endregion

				#region open_session_4
				using (IDocumentSession session = store.OpenSession())
				{
					// code here
				}
				#endregion

				#region open_session_5
				using (IAsyncDocumentSession session = store.OpenAsyncSession())
				{
					// async code here
				}
				#endregion
			}
		}
Ejemplo n.º 15
0
		public void CanAccessDbUsingDifferentNames()
		{
			using (GetNewServer())
			{
				using (var documentStore = new DocumentStore
				{
					Url = "http://localhost:8080"
				})
				{
					documentStore.Initialize();
					documentStore.DatabaseCommands.EnsureDatabaseExists("repro");
					using (var session = documentStore.OpenSession("repro"))
					{
						session.Store(new Foo
						{
							Bar = "test"
						});
						session.SaveChanges();
					}

					using (var session = documentStore.OpenSession("Repro"))
					{
						Assert.NotNull(session.Load<Foo>("foos/1"));
					}
				}
			}
		}
Ejemplo n.º 16
0
		public void LazyMultiLoadOperationWouldBeInTheSession()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8079" }.Initialize())
			{
				using (var session = store.OpenSession())
				{
					session.Store(new User());
					session.Store(new User());
					session.Store(new User());
					session.Store(new User());
					session.SaveChanges();
				}

				using (var session = store.OpenSession())
				{
					var result1 = session.Advanced.Lazily.Load<User>("users/1", "users/2");
					var result2 = session.Advanced.Lazily.Load<User>("users/3", "users/4");
					var a = result2.Value;
					Assert.Equal(1, session.Advanced.NumberOfRequests);
					var b = result1.Value;
					Assert.Equal(1, session.Advanced.NumberOfRequests);

					foreach (var user in b.Concat(a))
					{
						Assert.NotNull(session.Advanced.GetMetadataFor(user));
					}
				}
			}
		}
Ejemplo n.º 17
0
		public void Can_read_entity_name_after_update()
		{
			using(GetNewServer())
			using(var store = new DocumentStore{Url = "http://localhost:8080"}.Initialize())
			{
				using(var s =store.OpenSession())
				{
					s.Store(new Event {Happy = true});
					s.SaveChanges();
				}

				using (var s = store.OpenSession())
				{
					s.Load<Event>("events/1").Happy = false;
					s.SaveChanges();
				}

				using (var s = store.OpenSession())
				{
					var e = s.Load<Event>("events/1");
					var entityName = s.Advanced.GetMetadataFor(e)["Raven-Entity-Name"].Value<string>();
					Assert.Equal("Events", entityName);
				}
			}
		}
Ejemplo n.º 18
0
		public AggressiveCaching()
		{
			using (var documentStore = new DocumentStore { Url = "http://localhost:8080" })
			{
				documentStore.Initialize();

				#region should_cache_delegate
				documentStore.Conventions.ShouldCacheRequest = url => true;
				#endregion

				#region max_number_of_requests
				documentStore.MaxNumberOfCachedRequests = 2048;
				#endregion

				using (var session = documentStore.OpenSession())
				{
					#region aggressive_cache_load
					using (session.Advanced.DocumentStore.AggressivelyCacheFor(TimeSpan.FromMinutes(5)))
					{
						var user = session.Load<User>("users/1");
					}
					#endregion
				}

				using (var session = documentStore.OpenSession())
				{
					#region aggressive_cache_query
					using (session.Advanced.DocumentStore.AggressivelyCacheFor(TimeSpan.FromMinutes(5)))
					{
						var users = session.Query<User>().ToList();
					}
					#endregion
				}
			}
		}
Ejemplo n.º 19
0
		public void CanGetVeryBigResultSetsEvenThoughItIsBadForYou()
		{
			using (var server = GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8079" }.Initialize())
			{
				using (var session = store.OpenSession())
				{
					for (int i = 0; i < 15000; i++)
					{
						session.Store(new User { });
					}
					session.SaveChanges();
				}

				server.Database.Configuration.MaxPageSize = 20000;

				using (var session = store.OpenSession())
				{
					var users = session.Query<User>()
						.Customize(x=>x.WaitForNonStaleResults(TimeSpan.FromMinutes(1)))
						.Take(20000).ToArray();
					Assert.Equal(15000, users.Length);
				}
			}
		}
Ejemplo n.º 20
0
		public void CanUseRemoteDTC()
		{
            using (var server = GetNewServer(requestedStorage: "esent"))
			{
                EnsureDtcIsSupported(server);
			    
				using(var store = new DocumentStore{ Url = "http://*****:*****@b" };
						s2.Store(u2);
						s2.SaveChanges();
						tx2.Complete();
					}

					using (var s3 = store.OpenSession())
					{
						s3.Advanced.AllowNonAuthoritativeInformation = false;
						happy = s3.Load<User>(u2.Id) != null;
					}

					Assert.True(happy);
				}
			}	
		}
Ejemplo n.º 21
0
        public void CanCreateDatabaseUsingExtensionMethod()
        {
            using (GetNewServer(8080))
            using (var store = new DocumentStore
            {
                Url = "http://localhost:8080"
            }.Initialize())
            {
                store.DatabaseCommands.EnsureDatabaseExists("Northwind");

                string userId;

                using (var s = store.OpenSession("Northwind"))
                {
                    var entity = new User
                    {
                        Name = "First Mutlti Tenant Bank",
                    };
                    s.Store(entity);
                    userId = entity.Id;
                    s.SaveChanges();
                }

                using (var s = store.OpenSession())
                {
                    Assert.Null(s.Load<User>(userId));
                }

                using (var s = store.OpenSession("Northwind"))
                {
                    Assert.NotNull(s.Load<User>(userId));
                }
            }
        }
        public void CreateNewDocumentAnd_AndMakeChanges()
        {
            using (var docStore = new DocumentStore { Url = "http://localhost:8080", DefaultDatabase = "OptimisticConcurencyTestDB" })
            {
                docStore.Initialize();

                string id = null;

                using (var session = docStore.OpenSession())
                {
                    var item = new Item { Name = "ItemInInitialState" };
                    session.Store(item);
                    session.SaveChanges();
                    id = item.Id;
                }

                using (var sessionFirst = docStore.OpenSession())
                {
                    using (var sessionSecond = docStore.OpenSession())
                    {
                        sessionSecond.Advanced.UseOptimisticConcurrency = true;

                        var itemFirst = sessionFirst.Load<Item>(id);
                        var itemSecond = sessionSecond.Load<Item>(id);

                        itemFirst.Name = "ChangedByItemFirst";
                        sessionFirst.SaveChanges();

                        itemSecond.Name = "ChangedbyItemSecond";
                        sessionSecond.SaveChanges();  // this line should throw if optimistic concurency is enabled.
                    }
                }
            }
        }
Ejemplo n.º 23
0
		public void CanIndexOnRangeForNestedValuesForDictionaryAsPartOfDictionary()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8080" }.Initialize())
			{
				using (var s = store.OpenSession())
				{
					s.Store(new UserWithIDictionary
					{
						NestedItems = new Dictionary<string, NestedItem>
					    {
					        { "Color", new NestedItem{ Value=50 } }
					    }
					});
					s.SaveChanges();
				}

				using (var s = store.OpenSession())
				{
					Assert.DoesNotThrow(() => s.Advanced.LuceneQuery<UserWithIDictionary>()
					                          	.WhereEquals("NestedItems,Key", "Color")
					                          	.AndAlso()
					                          	.WhereGreaterThan("NestedItems,Value.Value", 10)
					                          	.ToArray());
				}
			}
		}
        public void LoadExistingDocument_AndMakeChanges()
        {
            using (var docStore = new DocumentStore { Url = "http://localhost:8080", DefaultDatabase = "OptimisticConcurencyTestDB" })
            {
                docStore.Initialize();

                string id = "items/33";

                using (var sessionFirst = docStore.OpenSession())
                {
                    using (var sessionSecond = docStore.OpenSession())
                    {
                        sessionSecond.Advanced.UseOptimisticConcurrency = true;

                        var itemFirst = sessionFirst.Load<Item>(id);
                        var itemSecond = sessionSecond.Load<Item>(id);

                        itemFirst.Name = "ChangedByItemFirst";
                        sessionFirst.SaveChanges();

                        itemSecond.Name = "ChangedbyItemSecond";
                        sessionSecond.SaveChanges();  // this line should throw if optimistic concurency is enabled.
                    }
                }
            }
        }
Ejemplo n.º 25
0
		public void CanAggressivelyCacheLoads()
		{
			using (var server = GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8079" }.Initialize())
			{
				using (var session = store.OpenSession())
				{
					session.Store(new User());
					session.Store(new User());
					session.SaveChanges();
				}

				WaitForAllRequestsToComplete(server);
				server.Server.ResetNumberOfRequests();

				for (int i = 0; i < 5; i++)
				{
					using (var session = store.OpenSession())
					{
						using (session.Advanced.DocumentStore.AggressivelyCacheFor(TimeSpan.FromMinutes(5)))
						{
							session.Advanced.Lazily.Load<User>("users/1");
							session.Advanced.Lazily.Load<User>("users/2");

							session.Advanced.Eagerly.ExecuteAllPendingLazyOperations();
						 }
					}
				}

				WaitForAllRequestsToComplete(server);
				Assert.Equal(1, server.Server.NumberOfRequests);
			}
		}
Ejemplo n.º 26
0
		public void CanQueryDtcForUncommittedItem()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8080" }.Initialize())
			{
				for (int i = 0; i < 150; i++)
				{
					string id;
					using (var tx = new TransactionScope())
					{
						System.Transactions.Transaction.Current.EnlistDurable(ManyDocumentsViaDTC.DummyEnlistmentNotification.Id,
																			  new ManyDocumentsViaDTC.DummyEnlistmentNotification(),
																			  EnlistmentOptions.None);

						using (var session = store.OpenSession())
						{
							var entity = new User();
							session.Store(entity);
							session.SaveChanges();
							id = entity.Id;
						}


						tx.Complete();
					}
					using (var session = store.OpenSession())
					{
						session.Advanced.AllowNonAuthoritiveInformation = false;
						var user = session.Load<User>(id);
						Assert.NotNull(user);
					}
				}
			}
		}
Ejemplo n.º 27
0
		public void CanSaveAndLoadSameTimeLocal()
		{
			using(GetNewServer())
			using (var store = new DocumentStore{Url = "http://localhost:8079"}.Initialize())
			{
				using (var session = store.OpenSession())
				{
					var serviceExecutionLog = new ServiceExecutionLog
					{
						LastDateChecked = new DateTime(2010, 2, 17, 19, 06, 06, DateTimeKind.Local)
					};

					session.Store(serviceExecutionLog);

					session.SaveChanges();

				}

				using (var session = store.OpenSession())
				{
					var log = session.Load<ServiceExecutionLog>("ServiceExecutionLogs/1");
					Assert.Equal(new DateTime(2010, 2, 17, 19, 06, 06), log.LastDateChecked);
				}
			}
		}
Ejemplo n.º 28
0
		public void Mulitenancy_Test()
		{
			using (GetNewServer(8080))
			using (var store = new DocumentStore
			{
				Url = "http://localhost:8080",
				DefaultDatabase = "Test"
			}.Initialize())
			{
				store.DatabaseCommands.PutIndex("TestIndex",
												new IndexDefinitionBuilder<Test, Test>
												{
													Map = movies => from movie in movies
																	select new {movie.Name}
												});

				using (var sess = store.OpenSession())
				{
					sess.Store(new Test {Name = "xxx"});

					sess.SaveChanges();
				}

				using (var sess = store.OpenSession())
				{
					var result = sess.Query<Test>("TestIndex")
						.Customize(x=>x.WaitForNonStaleResults())
						.Where(x => x.Name == "xxx")
						.FirstOrDefault();

					Assert.NotNull(result);
				}
			}
		}
Ejemplo n.º 29
0
		public void CanUseStats()
		{
			using (GetNewServer())
			using (var docStore = new DocumentStore { Url = "http://localhost:8079" }.Initialize())
			{
				using (var session = docStore.OpenSession())
				{
					session.Store(new User { Name = "Ayende" });
					session.Store(new User { Name = "Oren" });
					session.SaveChanges();
				}


				using (var session = docStore.OpenSession())
				{
					RavenQueryStatistics stats;
					session.Query<User>()
						.Customize(x=>x.WaitForNonStaleResults())
						.Statistics(out stats)
						.Lazily();

					session.Advanced.Eagerly.ExecuteAllPendingLazyOperations();

					Assert.Equal(2, stats.TotalResults);
				}
			}
		}
Ejemplo n.º 30
0
		public static void Main (string[] args)
		{
			Console.WriteLine ("Hello World!");
			using(var documentStore = new DocumentStore(){Url = "http://localhost:8080"})
			{
				documentStore.Initialize();
				using(DocumentSession documentSession = (DocumentSession)documentStore.OpenSession())
				{
					documentSession.Store(new Item{Name = "RavenDB Test1", Description = "NoSQL Document Store1"});
					documentSession.Store(new Item{Name = "RavenDB Test2", Description = "NoSQL Document Store2"});
					documentSession.Store(new Item2{ x = 1, y = 2});
					documentSession.Store(new Item2{ x = 3, y = 4});
					documentSession.SaveChanges();
				}
				
				using(var documentSession = documentStore.OpenSession())
				{
					Item item1 = documentSession.Load<Item>("items/1");
					Item item2 = documentSession.Load<Item>("items/2");
					Item2 item21 = documentSession.Load<Item2>("item2s/1");
					Item2 item22 = documentSession.Load<Item2>("item2s/2");
					Console.WriteLine("{0}\n{1}\n",item1,item2);
					Console.WriteLine("{0}\n{1}\n",item21,item22);
					
					var itemResult = documentSession.Query<Item>()
						.Where(item => item.Name == "RavenDB Test2")
							.First();
					Console.WriteLine("{0}",itemResult);
				}
			}			
		}