Is there a free LINQ debugger out there? I am terrible at LINQ and the only way I am every going to improve is to have some simple debugger where I can debug the idiotic mistakes that I make with it.
Any advice? A simple Google query nets bupkis free debuggers.
Linqpad is very good for debugging/creating LINQ queries
Related
In my code I have few instructions that are connecting to my database. I would like to know how fast are they executing. I know that I can write some kind of a timer, but pasting this code into few places and then removing it after measurement, will surely leave some mess.
I want to know if maybe VS2012 has any tool to help me with that? Or is there any addon maybe?
Just a quick one-off use of the Stopwatch class can give you insight.
Do beware that such a test isn't actually that useful. It will repeat very poorly, dbase connection times heavily depend on network traffic overhead and dbase server usage. And worst of all, there just isn't anything you can do about it in your code. Spending time on profiling code that you cannot improve is not a very productive use of your time.
You might actually want to leave that code in place so that the user has some idea why the program is performing poorly. Whether that is useful is hard to tell.
Building an application with a database that has the ability to get big not HUGE but definate big tables with a million records +. I just saw somewhere that LINQ isn't good for Big Datbases.
Front end will be in Silverlight and I was really looking forward to using its Skip and Take functionality for the Asynchronous calls to speed up the Clients first access to my GUI.
What can you tell me would be wrong with this scenario?
Woudl you use LINQ or something else?
MY BAck End is SQL Server 2005 or better.
I would use WCF Data Services (to serve the data from the server to the Silverlight application) with Entity Framework 4 backing those services.
You might also want to check out this article from the MSDN magazine that walks you through creating a simple Entity Data Model (from the ground up), WCF Data Services on top of your model, and then how to consume those services from Silverlight:
Visual Studio - Entity Framework 4.0 and WCF Data Services 4.0 in Visual Studio 2010
I agree with Justin's answer and am only submitting my own answer because no one appears to have answered the question you posed in one of your comments.
"Whats Entity have thats great and makes it faster and easier?"
* LINQ used in conjunction with Entity Framework provides a very clean syntax that after some learning curve is easier to write.
* IMO it is easier to read from nearly the beginning.
* You get Intellisense.
* You do not have the mess of SQL embedded in C# or VB.
* You get a nice document.
Bottom line is you more get better (easier to maintain) C# code.
I should also add that these same benefits can be gained from using NHibernate and other ORM tools. Entity Framework is not your only choice.
LINQ actually converts your LINQ code syntax into SQL commands (under the hood). If you have any doubts about this, you can use the SQL Profiler (also known as SQL Trace) to see the SQL commands that are generated by LINQ behind the scenes.
Performance-wise, it should be similar to ADO.NET.
I agree with Justin you should definitely use Entities, but you should be using LINQ on the entities in the form of cached queries to Lists.
IdeaBlade's DevForce may offer a more comprehensive solution.
Back in late 2008 there was a lot of debate about the future of LINQ to SQL. Many suggested that Microsoft's investments in the Entity Framework in .NET 4.0 were a sign that LINQ to SQL had no future. I figured I'd wait before making my own decision since folks were not in agreement.
Fast-forward 18 months and I've got vendors providing solutions that rely on LINQ to SQL and I have personally given it a try and really enjoyed working with it. I figured it was here to stay.
But I'm reading a new book (C# 4.0 How-To by Ben Watson) and in chapter 21 (LINQ), he suggests that it "has been more or less deprecated by Microsoft" and suggests using LINQ to Entity Framework.
My question to you is whether or not LINQ to SQL is officially deprecated and/or if authoritative entities (Microsoft, Scott Gu, etc.) officially suggest using LINQ to Entities instead of LINQ to SQL.
For all the "Linq-to-SQL is dead" folks: Scott Guthrie himself clearly mentioned at TechEd Europe that Linq-to-SQL is FULLY SUPPORTED in .NET 4, and Damien Guard posted a blog post on what changes and improvements have been made for Linq-to-SQL in .NET 4.
To quote Mark Twain: "Reports of my death have been greatly exaggerated"......
Last I checked, this very site uses (or used to use) Linq To SQL. Joel Spolsky mentions this in his GoogleTechTalk: http://www.youtube.com/watch?v=NWHfY_lvKIQ.
When speaking of software, "dead" is a figurative modifier (software doesn't die in any literal, biological sense), so this debate can linger on as long as the involved parties refuse to define in any literal sense what it means for "Linq To Die". Or, LTD for short. Hence, as of this moment, the LTD debate has lingered for two years. All because of a little linguistic ambiguity.
Those who say that "L2S is dead" are generally referring to the fact that L2S isn't going to receive too many (if any) new features. Updates to Linq (like the updates mentioned in Damien Guard's post) are likely to be confined to performance, usability, and stability updates. Of course, some developers might actually argue that this is a good thing (probably the same developers who are a wee bit angry about the new dynamic type).
Those who say that "L2S is not dead" are generally referring to the fact that L2S isn't going to be cut altogether from .Net (at least not anytime soon). Think: ADO. It may lose some of its traction amongst practicing developers (and that may be the unspoken desire of those crafty folks at Microsoft), but that doesn't mean that you won't be able to use L2S if you want to. It just means that Microsoft isn't trying to tantalize the masses with it.
When starting a project, I actually think it's great that I have a choice between EF and L2S. As Bill Wagner points out, there's a time and a place for both.
I am late to this discussion, but I wanted to point out that as far back as 2008, the Link to SQL Project Manager (Tim Mallalieu) made this announcement in his blog post,
"As of .NET 4.0, LINQ to Entities [rather than LINQ to SQL] will be the recommended data access solution for LINQ to relational scenarios."
I have found no other more recent announcements to the contrary.
No it is not. The team are still working on improving it.
LINQ to SQL tools in Visual Studio
LINQ to SQL was the first object-relational mapping technology
released by Microsoft. It works well in basic scenarios and continues
to be supported in Visual Studio, but it's no longer under active
development. Use LINQ to SQL when maintaining a legacy application
that's already using it, or in simple applications that use SQL Server
and do not require multi-table mapping. In general, new applications
should use the Entity Framework when an object-relational mapper layer
is required.
Make sure to have a look at this article posted on InfoQ.com - it's a really interesting one. Its conclusion: "[O]ver the long run LINQ to SQL and LINQ to Entities will merge. In the mean time, development work on LINQ to SQL will not end entirely."
i guess it's inevitsble that they'll merge. EF is really an enterprise level implementation of LINQ over db objects. linq2sql was to all intents a proof of concept(and a lot more) that actually grew legs but fuelled many of the ideas that we now see in EF. at the end of the day, the DAL layer (nhibernate, EF, l2s, subsonic etc) should be pretty far down the chain so as to negate any differences in the client BO code that implents the LINQ service - hot swappable would be the end game via DI.
ive been debugging sql 2005 stored procedures in visual studio 2005 and find it really frustrating that i can't run a sql query while stepping through the code.
specifically my main issues are...
if my SP inserts/updates to temp tables then i cant query those tables while debugging. would be cool if i could use the immediate window to run sql.
if my SP is run under a transaction i then again cant query any tables it effects while debugging. even if i switch over to sql management studio and run a query for uncommitted data.
only thing i can check in the debugger are local variables used in the SP which isnt all that helpful.
anyone know of a better way to debug? is this any better in VS.net 2008 or 2010?
Add lots of diagnostic SELECTS and PRINT statements.
Hey, it's what all of us programmers had to do back in the day before Debuggers. It's not that bad once you get used to it.
Also, this is one more, Very Good reason to keep the procedures small.
I have used real debuggers with SQL (other versions) and the truth is that well-written SQL benefits very little from a traditional debugger anyway. Declarative, Set-based code just doesn't fit that model well. Now poorly-written SQL (procedural, imperative, etc.) does, but the better you design the procedure, the less reason you have for a debugger anyway.
A better solution, IMHO, if you need that what a debugger could do for you, is to use the SQL Profiler, which has the advantage of being able to tell you what a procedure is actually doing in production, instead of just what it does in you artificial tests.
Here is an article on how to do it with Visual Studio 2005. Havent tried it myself, but 4GuysFromRolla have provided good info for me in the past.
Better go through the this Debug proc
I got the idea from here.Hope this will help you too. This is the same way for VS 2008
I heard about a very nice Linq/NHibernate alternative O-R bridge, but darnit can't remember its name. I remember their site featured very instructive screencap video tuts by the developers and the tool can be used as a replacement for Linq.
Help! Any pointers?
I haven't used this, only evaluated it: LightSpeed. Out of all the ORM products I tried, this was the only one that installed flawlessly and handled our SQL 2008 DB without complaining. Beautiful designer, really -- MS could learn from them.
The devs are friendly, respond VERY fast, and make nightly builds available. If I understand their licensing, its ridiculously cheap. Overall, they really make you want to buy their products.
(And no, I'm not associated with them, just impressed.)
i think you're thinking of SubSonic