Parameter Prompt for all fields in Where, Select, Join?

Discussion of issues, suggestions and bugs of LINQ Insight, Visual Studio add-in for design-time executing LINQ statements, that simplifies debugging LINQ
Post Reply
k.morris
Posts: 2
Joined: Tue 24 Apr 2018 13:00

Parameter Prompt for all fields in Where, Select, Join?

Post by k.morris » Tue 24 Apr 2018 13:41

I'm just getting started with Linq Insight and running into my first issue. When attempting to run 'simpleQuery' below, i'm prompted for not only the query parameter 'ContactID' but also the field in the where clause 'IDContact' and the field from the select 'FirstName'. I don't know the 'FirstName' field, which is what we are querying for, but I'm able to leave that blank and setting both parameters for 'ContactID' and 'IDContact' are required. I know the 'ContactID' value is 1, so I can plug this in for both 'ContactID' and 'IDContact' to get the query to run and Linq Insight returns the correct 'FirstName' of 'Tim'.

Code: Select all

[HttpPost]
        public JsonNetResult LingInsight(int ContactID)
        {
            var simpleQuery = db.Contact.Where(c => c.IDContact == ContactID).Select(c => c.FirstName).FirstOrDefault();
            return new JsonNetResult(new { status = "OK" });
        }
Image

Seems odd that I have to enter values for two fields when there is only 1 parameter to this query. But when I add join in to a query, it becomes unusable. Running the below query 'queryWithJoin' prompts for parameters for the fields in each join as well, i know the value for 'detailID', but I don't know the values for the fields used in the join and to enter parameters here would reduce the number of results.

Code: Select all

[HttpPost]
        public JsonNetResult LingInsight(int detailID)
        {
            var queryWithJoin = (from detail in db.ContactDetail
                                       join cont in db.Contact on detail.ContactID equals cont.IDContact
                                       where detail.IDContactDetail == detailID
                                       select new { cont.FirstName, detail.DetailValue }).ToList();

            return new JsonNetResult(new { status = "OK" });
        }
Image

The parameters ContactID and IDContact are required and can't continue without entering a value for them. Is this a limitation of Linq Insight or am I doing it wrong?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Parameter Prompt for all fields in Where, Select, Join?

Post by Shalex » Fri 27 Apr 2018 18:24

Thank you for your report. Please specify:
1) the name of your ORM (e.g.: Entity Framework 6)
2) the version of your Visual Studio (e.g.: VS 2017 Professional)

k.morris
Posts: 2
Joined: Tue 24 Apr 2018 13:00

Re: Parameter Prompt for all fields in Where, Select, Join?

Post by k.morris » Wed 09 May 2018 19:53

1) Entity Framework 6.2.0
2) VS 2017 Professional Version 15.7.0

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Parameter Prompt for all fields in Where, Select, Join?

Post by Shalex » Tue 15 May 2018 08:13

We have reproduced the issue and are investigating it. We will notify you about the result.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Parameter Prompt for all fields in Where, Select, Join?

Post by Shalex » Wed 18 Mar 2020 20:20

* The bug with detecting redundant non-nullable variables in LINQ queries is fixed
* The bug with non-detecting nullable variables in LINQ queries is fixed

Please upgrade to v3.7.16.

Post Reply