Queries with local collections are not supported

Source: Internet
Author: User
Tags requires

I. Events

A recent project requires the following query to be implemented:

There are three tables: papers (Paper), periodicals (Magazine), journal Discipline Classifications (Magazinesubjectclass), and three relationships: papers and periodicals have a one-to-many relationship (one paper corresponds to one journal, one journal corresponds to multiple papers), The relationship between periodical and periodical classifications is One-to-many (a journal corresponds to multiple classifications), as shown in the figure:

The query that requires implementation is as follows:

A "Subject classification" set (a string array) is given, and the query is published in a journal of "Disciplinary Classification" belonging to this collection.

Ii. Response Events

My thinking is as follows:

Find a qualified magazine based on a disciplinary classification

Find a paper that meets the requirements according to the magazine

So I wrote the following LINQ statement:

Iqueryable<magazine> magazines = database. Magazines.asqueryable ();
if (PaperQueryInformation.MagazineQueryInformation.SubjectClass!= null && PaperQueryInformation.MagazineQueryInformation.SubjectClass.Length!= 0)
{
Magazines = database. Magazinesubjectclasses
. Where (q => paperQueryInformation.MagazineQueryInformation.SubjectClass.Contains (Q.subjectclass))
. Select (q => q.magazine)
. Distinct ();
query = Query
. Where (q => magazines. Contains (Q.magazine));
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.