Precious Roy
Precious Roy

Reputation: 1086

Lightswitch global query breaking app

I'm trying out Lightswitch for the first time, and I'm finding some of the 'built-in' features aren't as easy to implement as the videos show. The most notable being global queries, because everyone I create is causing a specific error that I cannot find a cause for. I've stripped it down to a query that does nothing but return a 'select *' on the table, and removed any code I've added.

Here is the query in my solution explorer:

MyGroups

And here it is in the designer:

query details

Simple enough, so I add a screen for the query:

query screen

Everything is pure default, so why do I get this error? It says it doesn't recognize the query at all, and gives a weird dll error.

I've tried recreating it as a couple different kinds of screens, but I followed this tutorial where they use a List and Details Screen in this way. The best I can come up with is that I'm experiencing a bug due to having VS 2012 and .NET 4.5 installed as well (don't ask me why). I'm just curious if this makes sense to anyone else, or if anyone else has been successful in creating these.

P.S. - I've also been unsuccessful in accessing the permissions I created by their name. I eventually figured out I could reference them by their index, but why is that necessary? I saw nothing about needing to add a reference to make this work.

partial void CustomerNew_CanRun(ref bool result)
{
    result = User.HasPermission(Permissions.AllPermissions[1]);
}

Upvotes: 0

Views: 110

Answers (1)

Yann Duran
Yann Duran

Reputation: 3879

OK, just to reassure you a bit (maybe), this is not normal, & I haven't seen this or heard of anything similar.

The fact that you can't access any of your permissions by name indicates something's definitely not right. You should be able to use Permissions.NameOfOneOfMyPermissions.

Starting from the basics, have you rebuilt the solution (note rebuilt, not just built)? What you'll often find with LightSwitch is that one error will cause a whole series of other errors to appear in the list, which can look quite daunting. When you fix the original error, the rest disappear. Double-click the error in the Error pane, & you should be taken to where the error is occurring. If you can't make sense of it, past the code here & I'll see if I can figure out what's wrong.

You'll also need to check that there isn't some code left over from any previous attempt at following the tutorial. Try adding a query with a different name, & see if the error has the new name in it, or the old one.

Upvotes: 1

Related Questions