Overclock.net - An Overclocking Community - View Single Post - How to optimize this SQL query

View Single Post
post #4 of (permalink) Old 12-04-2018, 02:38 PM - Thread Starter
New to Overclock.net
Mrzev's Avatar
Join Date: Feb 2008
Location: Texas
Posts: 2,258
Rep: 96 (Unique: 76)
No, its C# code using entity framework that is querying a SQL db. There are a few ways to query it, and this style is very close to SQL. ( i would also need to lookup how to do a join using the other style)

Here is a couple examples from the other style I tend to use more.

  var userPermissions = db.ApplicationUserSourcePermissions.Where(a => a.ApplicationUserId == new Guid(User.Identity.GetUserId()));
            if (!userPermissions.Where(a => a.SourceId == myAsset.SourceId).Any())  // If User does not have permission
                return null;


                    var grouped = data
                    .GroupBy(u => u.Item1)
                    .Select(grp => grp.ToList())
                    //construct filter                    
                    foreach (var itemGroup in grouped)

Mrzev is offline