Skip to main content
edited tags
Link
VLAZ
  • 28.8k
  • 9
  • 62
  • 82
added 5 characters in body
Source Link
satish kumar V
  • 1.8k
  • 7
  • 34
  • 49

This is the code that I am trying to implement paging for DocumentDB to get all the students in 10th class A section.

It is working fine in console application.

But when I am trying to do in my web application, at async call (i.e; query.ExecuteNextAsync()) the process is terminating and It even doesn't give any exception.

public List<Student> allStudents()
        {
            int class = 10;
            string section = "A";
            string documentType = "Student";
            List<Student> students = new List<Student>();
            string DocumentDBCollectionLink = "CollectionLink";
            DocumentClient dc = new DocumentClient(new Uri("https://xyz.documents.azure.com:443/"), "authenticationKey==");
            IDocumentQuery<Student> query;
            String continuation = "";
            do
            {
                FeedOptions feedOptions = new FeedOptions { MaxItemCount = 10, RequestContinuation = continuation };
                query = dc.CreateDocumentQuery<Student>(DocumentDBCollectionLink, feedOptions).Where(d => d.Type.Equals(documentType) && d.Class == .Equals(class) && d.Section.Equals(section)).AsDocumentQuery();

                FeedResponse<Student> pagedResults = this.getRecords(query).Result;
                foreach (Student system in pagedResults)
                {
                    students.Add(system);
                }
                continuation = pagedResults.ResponseContinuation;
            } while (!String.IsNullOrEmpty(continuation));
            return students;
        }
    private async Task<FeedResponse<Student>> getRecords(IDocumentQuery<Student> query)
    {
        FeedResponse<Student> pagedResults = await query.ExecuteNextAsync<Student>();
        return pagedResults;
    }

I am not getting why it is executing in console application, but not in web application.

Anything wrong with this?

Or any better way to get the result?

Any help would be greatly appreciated.

Thanks in advance.

This is the code that I am trying to implement paging for DocumentDB to get all the students in 10th class A section.

It is working fine in console application.

But when I am trying to do in my web application, at async call (i.e; query.ExecuteNextAsync()) the process is terminating and It even doesn't give any exception.

public List<Student> allStudents()
        {
            int class = 10;
            string section = "A";
            string documentType = "Student";
            List<Student> students = new List<Student>();
            string DocumentDBCollectionLink = "CollectionLink";
            DocumentClient dc = new DocumentClient(new Uri("https://xyz.documents.azure.com:443/"), "authenticationKey==");
            IDocumentQuery<Student> query;
            String continuation = "";
            do
            {
                FeedOptions feedOptions = new FeedOptions { MaxItemCount = 10, RequestContinuation = continuation };
                query = dc.CreateDocumentQuery<Student>(DocumentDBCollectionLink, feedOptions).Where(d => d.Type.Equals(documentType) && d.Class == class && d.Section.Equals(section)).AsDocumentQuery();

                FeedResponse<Student> pagedResults = this.getRecords(query).Result;
                foreach (Student system in pagedResults)
                {
                    students.Add(system);
                }
                continuation = pagedResults.ResponseContinuation;
            } while (!String.IsNullOrEmpty(continuation));
            return students;
        }
    private async Task<FeedResponse<Student>> getRecords(IDocumentQuery<Student> query)
    {
        FeedResponse<Student> pagedResults = await query.ExecuteNextAsync<Student>();
        return pagedResults;
    }

Anything wrong with this?

Or any better way to get the result?

Any help would be greatly appreciated.

Thanks in advance.

This is the code that I am trying to implement paging for DocumentDB to get all the students in 10th class A section.

It is working fine in console application.

But when I am trying to do in my web application, at async call (i.e; query.ExecuteNextAsync()) the process is terminating and It even doesn't give any exception.

public List<Student> allStudents()
        {
            int class = 10;
            string section = "A";
            string documentType = "Student";
            List<Student> students = new List<Student>();
            string DocumentDBCollectionLink = "CollectionLink";
            DocumentClient dc = new DocumentClient(new Uri("https://xyz.documents.azure.com:443/"), "authenticationKey==");
            IDocumentQuery<Student> query;
            String continuation = "";
            do
            {
                FeedOptions feedOptions = new FeedOptions { MaxItemCount = 10, RequestContinuation = continuation };
                query = dc.CreateDocumentQuery<Student>(DocumentDBCollectionLink, feedOptions).Where(d => d.Type.Equals(documentType) && d.Class.Equals(class) && d.Section.Equals(section)).AsDocumentQuery();

                FeedResponse<Student> pagedResults = this.getRecords(query).Result;
                foreach (Student system in pagedResults)
                {
                    students.Add(system);
                }
                continuation = pagedResults.ResponseContinuation;
            } while (!String.IsNullOrEmpty(continuation));
            return students;
        }
    private async Task<FeedResponse<Student>> getRecords(IDocumentQuery<Student> query)
    {
        FeedResponse<Student> pagedResults = await query.ExecuteNextAsync<Student>();
        return pagedResults;
    }

I am not getting why it is executing in console application, but not in web application.

Anything wrong with this?

Or any better way to get the result?

Any help would be greatly appreciated.

Thanks in advance.

some grammatical mistakes.. to understand what you say
Source Link

thisThis is the code whatthat I am trying to implement paging for DocumentDB to get all the students in 10th class A section.

ThisIt is working fine in console application.

But when I am trying to do in my web application, at async call (i.e; query.ExecuteNextAsync()) the process is terminating and It even doesn't give any exception.

public List<Student> allStudents()
        {
            int class = 10;
            string section = "A";
            string documentType = "Student";
            List<Student> students = new List<Student>();
            string DocumentDBCollectionLink = "CollectionLink";
            DocumentClient dc = new DocumentClient(new Uri("https://xyz.documents.azure.com:443/"), "authenticationKey==");
            IDocumentQuery<Student> query;
            String continuation = "";
            do
            {
                FeedOptions feedOptions = new FeedOptions { MaxItemCount = 10, RequestContinuation = continuation };
                query = dc.CreateDocumentQuery<Student>(DocumentDBCollectionLink, feedOptions).Where(d => d.Type.Equals(documentType) && d.Class == class && d.Section.Equals(section)).AsDocumentQuery();

                FeedResponse<Student> pagedResults = this.getRecords(query).Result;
                foreach (Student system in pagedResults)
                {
                    students.Add(system);
                }
                continuation = pagedResults.ResponseContinuation;
            } while (!String.IsNullOrEmpty(continuation));
            return students;
        }
    private async Task<FeedResponse<Student>> getRecords(IDocumentQuery<Student> query)
    {
        FeedResponse<Student> pagedResults = await query.ExecuteNextAsync<Student>();
        return pagedResults;
    }

Anything wrong with this?

Or any better way to get the result?

Any help would be greatly appreciableappreciated.

Thanks in advance.

this is the code what I am trying to implement paging for DocumentDB to get all the students in 10th class A section.

This is working fine in console application.

But when I am trying to do in my web application, at async call (i.e; query.ExecuteNextAsync()) the process is terminating and even doesn't give any exception.

public List<Student> allStudents()
        {
            int class = 10;
            string section = "A";
            string documentType = "Student";
            List<Student> students = new List<Student>();
            string DocumentDBCollectionLink = "CollectionLink";
            DocumentClient dc = new DocumentClient(new Uri("https://xyz.documents.azure.com:443/"), "authenticationKey==");
            IDocumentQuery<Student> query;
            String continuation = "";
            do
            {
                FeedOptions feedOptions = new FeedOptions { MaxItemCount = 10, RequestContinuation = continuation };
                query = dc.CreateDocumentQuery<Student>(DocumentDBCollectionLink, feedOptions).Where(d => d.Type.Equals(documentType) && d.Class == class && d.Section.Equals(section)).AsDocumentQuery();

                FeedResponse<Student> pagedResults = this.getRecords(query).Result;
                foreach (Student system in pagedResults)
                {
                    students.Add(system);
                }
                continuation = pagedResults.ResponseContinuation;
            } while (!String.IsNullOrEmpty(continuation));
            return students;
        }
    private async Task<FeedResponse<Student>> getRecords(IDocumentQuery<Student> query)
    {
        FeedResponse<Student> pagedResults = await query.ExecuteNextAsync<Student>();
        return pagedResults;
    }

Anything wrong with this?

Or any better way to get the result?

Any help would be greatly appreciable.

Thanks in advance.

This is the code that I am trying to implement paging for DocumentDB to get all the students in 10th class A section.

It is working fine in console application.

But when I am trying to do in my web application, at async call (i.e; query.ExecuteNextAsync()) the process is terminating and It even doesn't give any exception.

public List<Student> allStudents()
        {
            int class = 10;
            string section = "A";
            string documentType = "Student";
            List<Student> students = new List<Student>();
            string DocumentDBCollectionLink = "CollectionLink";
            DocumentClient dc = new DocumentClient(new Uri("https://xyz.documents.azure.com:443/"), "authenticationKey==");
            IDocumentQuery<Student> query;
            String continuation = "";
            do
            {
                FeedOptions feedOptions = new FeedOptions { MaxItemCount = 10, RequestContinuation = continuation };
                query = dc.CreateDocumentQuery<Student>(DocumentDBCollectionLink, feedOptions).Where(d => d.Type.Equals(documentType) && d.Class == class && d.Section.Equals(section)).AsDocumentQuery();

                FeedResponse<Student> pagedResults = this.getRecords(query).Result;
                foreach (Student system in pagedResults)
                {
                    students.Add(system);
                }
                continuation = pagedResults.ResponseContinuation;
            } while (!String.IsNullOrEmpty(continuation));
            return students;
        }
    private async Task<FeedResponse<Student>> getRecords(IDocumentQuery<Student> query)
    {
        FeedResponse<Student> pagedResults = await query.ExecuteNextAsync<Student>();
        return pagedResults;
    }

Anything wrong with this?

Or any better way to get the result?

Any help would be greatly appreciated.

Thanks in advance.

Source Link
satish kumar V
  • 1.8k
  • 7
  • 34
  • 49
Loading