What Was I Thinking?

Follies & Foils of .NET Development
posts - 95 , comments - 352 , trackbacks - 0

February 2014 Entries

Resharper: Add “Locate in Solution Explorer” to the Code Window Tab Context Menu
I Love Resharper’s Find In Solution Explorer command. It locates the currently active code file in the solution explorer. Using my keyboard layout I can activate it using Shift+Alt+L, but most times I prefer to select it from the context menu of my code window tab, you know, this thing: Here’s how I added it: From the Tools menu select Customize On the Customize dialog click the Commands tab Select the Context Menu Radio button In the Context Menu drop down, scroll to the bottom and locate Other ......

Posted On Thursday, February 6, 2014 1:52 AM | Comments (2) | Filed Under [ Visual Studio ]

Invoking IDbSet<T>.FirstOrDefault(predicate) using reflection
Assuming you have a data context with a property of IDBSet<Person> and person has a property called Id, you can issue: var person = context.PersonDbSet.FirstOr... here’s how you do it with reflection: Assuming you have a reference to your data set, called dbset Begin with defining the predicate (the where statement) ParameterExpression parameter = Expression.Parameter(entity... "Id"); MemberExpression property = Expression.Property(parameter, 3); ConstantExpression rightSide ......

Posted On Saturday, February 1, 2014 3:15 PM | Comments (0) |

Powered by: