Alias tables to "var names"
When I copy/paste from Visual Studio to LINQPad (and back) I have to rename all the table variables to the real table names.
If I could alias a table, e.g. "Products" into "myProductsTable" the transition from VS to LP would be smooth.
![](https://secure.gravatar.com/avatar/1b78e1affe3cd8053ba352a393da205b?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
-
Chen Amit commented
How do I do that?
-
Bear in mind that you can also create a connection in LINQPad that consumes the typed DataContext that you've created in VS. This will ensure a perfect match with VS.
-
Chen Amit commented
I just had another case for this need. Not sure how easy it is to resolve.
In my Linq code, I compare a database field to a win control value: "numericUpDownThreshold.Value".
Again, if I work on a piece of code, setting aliases to all these names helps. -
Chen Amit commented
I hear ya. Didn't think about it and it's a good temp workaround.
The way I use LP (great tool! thanks!) is move back and forth from VS.
Now I have to add 3-4 lines of code every time I copy/paste between them.
It works, but aliases would make it easier/transparent. -
You can do this right now:
var custs = Customers;
custs.Where (c => c.Name.StartsWith ("A")).Dump();