![]() I'm afraid this post doesn't adequately convey LINQPad's awesomeness. There are several premium license versions starting at US $59, which add autocompletion & tooltips, code formatting, cross-database querying, etc. There is a free version, which I'm ashamed to admit I used for probably thousands of hours before finally doing the right thing and sending some money Joseph's way. format a column containing JSON with indentation.run the SQL Server query "WITH (NOLOCK)" (in a TransactionScope with IsolationLevel.ReadUncommitted, actually) so it doesn't tie up the table.In this example query, the underlined code uses extensions I wrote to: NET DLLs and NuGet packages and use them in your queries and create/save your own extension methods and classes and use them in your queries: I almost never use SQL Server Management Studio for SQL queries any more. If you do query with LINQ, you can click the results "SQL" tab to see the SQL that was generated: ![]() Querying with LINQ is what LINQPad was created for, but you can also query with plain old SQL: I use it a lot for quick code experimentation, and have amassed a collection of tiny utility "program" queries in LINQPad (JSON and XML formatting, removing line feeds and tabs from strings, etc.), but working with databases is LINQPad's main claim to fame.Īs shown in the animation below that I "borrowed" from Jiří Petržilka's blog, if you query a table with foreign keys, LINQPad shows those relationships as navigation links to those entities: If you want to quickly try out some code, instead of creating a console app in Visual Studio, you can just open up LINQPad and and type a line or two. ![]() That's because LINQPad isn't just for LINQ and databases - It's for any any C#/F#/VB expression, statement block or program. The screenshot above uses LINQ "query syntax", but of course, you can also use "method syntax" (.Where. Here's a screenshot from an early version of LINQPad (it still pretty much looks the same): NET, and Joseph Albahari introduced LINQPad almost immediately afterward, providing the ability to do database queries using LINQ as an alternative to SQL. NET 3.5 introduced (L)anguage (In)tegrated (Q)uery, one of the killer features of. I use it every day, several times per day. Towards the bottom it finally mentions some of the SqlFunction properties like IsDeterministic, but it talks about them like they're C# properties, not T-SQL parameters, so I have no idea how to use them in a create function statement.Of all my favorite tools, LINQPad is probably the favorite. The documentation for 'create function' is confusing and incomplete. IsDeterministic, DataAccess, Name, IsPrecise, etc.) and the method signature of the function into an appropriate T-SQL "CREATE FUNCTION" statement.Įxisting information I've already found to be not helpful: I need to know how to translate the SqlFunctionAttribute's properties (e.g. ![]() I assume the compiler/deployer uses reflection and properties of the SqlFunction attribute, so I'm also using reflection to gather a MethodInfo list of the static methods that have the SqlFunction attribute. in a check constraint), rather than just adding the new ones and updating the existing ones, so the deployment always fails.Īs a result, I'm writing my own code to update the assembly and add/update any functions. It tries to drop functions that are already referenced (e.g. Visual studio fails at deploying a database project. ![]()
0 Comments
Leave a Reply. |