Esempio n. 1
0
		public void IncludeMissingProperty()
		{
			new Answers_ByAnswerEntity().Execute(store);
			var answerId = ComplexValuesFromTransformResults.CreateEntities(store);
			using (var session = store.OpenSession())
			{
				var views = session
					.Query<Answer, Answers_ByAnswerEntity>()
					.Customize(x => x.Include("Fppbar").WaitForNonStaleResults())
					.Where(x => x.Id == answerId)
					.ToArray();
			}
		}
Esempio n. 2
0
		public void IncludeOnMapReduce()
		{
			new Votes_ByAnswerEntity().Execute(store);
			var answerId = ComplexValuesFromTransformResults.CreateEntities(store);
			using (var session = store.OpenSession())
			{
				var vote = session
					.Query<AnswerVote, Votes_ByAnswerEntity>()
					.Customize(x => x.Include("QuestionId").WaitForNonStaleResults())
					.Where(x => x.AnswerId == answerId)
					.FirstOrDefault();

				session.Load<Question>(vote.QuestionId);

				Assert.Equal(1, session.Advanced.NumberOfRequests);
			}
		}
Esempio n. 3
0
        public void write_then_read_from_complex_entity_types_lazily()
        {
            using (GetNewServer())
                using (var store = new DocumentStore {
                    Url = "http://localhost:8080"
                }.Initialize())
                {
                    IndexCreation.CreateIndexes(typeof(QuestionWithVoteTotalIndex).Assembly, store);

                    string answerId = ComplexValuesFromTransformResults.CreateEntities(store);
                    // Working
                    using (IDocumentSession session = store.OpenSession())
                    {
                        var answerInfo = session.Query <Answer, Answers_ByAnswerEntity>()
                                         .Customize(x => x.WaitForNonStaleResultsAsOfNow())
                                         .Where(x => x.Id == answerId)
                                         .As <AnswerEntity>()
                                         .Lazily();
                        Assert.NotNull(answerInfo.Value.ToArray().Length);
                    }
                }
        }