The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Is it possible to create a query that contains a subselect from different collection types?

Last post 05-09-2007, 7:31 AM by Mike.Griffin. 2 replies.
Sort Posts: Previous Next
  •  05-09-2007, 7:02 AM 2267

    Is it possible to create a query that contains a subselect from different collection types?

    "

    SELECT jobId,

    accountId,

    title,

    active,

    createdDate,

    updateDate,

    lastUpdateUser,

    assessmentId,

    templateJobPostingInfoId,

    (SELECT COUNT(*) AS Expr1

    FROM Posting

    INNER JOIN JobPostingInfo ON Posting.jobPostingInfoId = JobPostingInfo.JobPostingInfoId

    WHERE (Posting.postingStatusId = 1) AND (JobPostingInfo.JobId = Job.jobId)) AS ActivePostingCount

    FROM Job

    WHERE (accountId = @accountId)

  •  05-09-2007, 7:28 AM 2269 in reply to 2267

    Re: Is it possible to create a query that contains a subselect from different collection types?

    The answer is yes and no. EntitySpaces supplies you with a number of protected methods that you can use in your custom classes, one of which is the Load() method, with it you can populate EntitySpaces collections with stored procedures or raw sql, there is also the ExecuteNonQuery, ExecuteReader, and a bunch of other methods. However, subqueries are on our radar, if you scroll down to the bottom of this POST you can see what we are thinking on this subject.

    By the way, our blog has a ton of good stuff on it, many folks overlook it but it's really where provide the nitty-gritty.


    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  05-09-2007, 7:31 AM 2270 in reply to 2267

    Re: Is it possible to create a query that contains a subselect from different collection types?

    One more thing the problem with this is akin to those that ask for joins "on the fly" and that is you get data back for which you have no strongly typed properties, which basically means you want to work with raw datatables, of course, EntitySpaces has the SetColumn/GetColumn methods that can access any extra fields brought back. However, you most certainly can do this via the protected Load() method just not via the query.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
View as RSS news feed in XML