linqpad

LINQPad in Visual Studio

穿精又带淫゛_ 提交于 2019-12-17 23:36:12
问题 public static class Extensions{ public static void Dump<T>(this T o) { } public static void Dump<T>(this T o, string s) { }} These lines allow me to copy code from LINQPad to VS and run it without commenting out every line with .Dump() but it's not enough... http://code.google.com/p/linqpadvisualizer/ - not very comfortable :( The best result I get searching for LINQPad in VS is this site with code below by Pat Kujawa. using System.Diagnostics; using System.IO; public static class Extensions

How does LINQPad compile code?

非 Y 不嫁゛ 提交于 2019-12-17 23:02:06
问题 I am guessing it neither invokes csc.exe or implement an entire compiler, so how does it work? Update: Thanks to Jon Skeet for the pointer to code that was easy to learn from. string c = @" public class A { public static void Main(string[] args) { System.Console.WriteLine(""hello world""); } } "; CodeDomProvider compiler = new CSharpCodeProvider(); CompilerParameters parameters = new CompilerParameters(); parameters.WarningLevel = 4; parameters.GenerateExecutable = false; parameters

How to Connect to CRM Dynamics Online Odata endpoint LinqPad?

陌路散爱 提交于 2019-12-17 20:27:46
问题 I'm able to connect to self-hosted CRM sites just fine with the default Odata driver within LinqPad. The URI I use in the "WCF Data Services (OData) Connection" dialog for self-hosted is in the format http://MyServer.com/MyOrgName/xrmservices/2011/OrganizationData.svc. The user name is in the format "domain\username". When I attempt to follow the same format for an CRM Online instance, it doesn't work. I'm guessing it's either because of the https, or the windows live credentials, but don't

Recursive LINQ get hierarchy?

微笑、不失礼 提交于 2019-12-13 08:29:29
问题 I have this result table after my query Id Per_Router Prod_No Rout_No NULL 1 81253 77976 NULL 1 81235 77976 NULL 1 67907 77976 NULL 1 66772 77976 21202 2 NULL 77976 41978 1 NULL 77976 41979 1 NULL 77976 using LINQPAD I want to extract the whole hierarchy. As starting point 77976 but I want to get also for each sub-component ex. 81253, 81235, etc - recursive? Using query from db is very long to get each sub component record (Foxpro 6) I declare my self a beginner in this var query = from p in

How to solve issue “Could not translate expression …into SQL and could not treat it as a local expression.” [duplicate]

走远了吗. 提交于 2019-12-13 06:26:59
问题 This question already has answers here : Linq “Could not translate expression… into SQL and could not treat it as a local expression.” (3 answers) Closed 5 years ago . I have code below: void Main() { var q = from a in Applicants where(a.Claims.Any()) select a.Claims.Sum(c => c.TotalClaimAmount()); q.Dump(); } public static class MyExt { public static decimal TotalClaimAmount(this Claim c) { var t = c.Accommodations.Sum(a => a.AmountClaimed) + c.MealAllowances.Sum(ma => ma.AmountClaimed) + c

Using a string where clause with PredicateBuilder in LinqPad for creating dynamic where clause

家住魔仙堡 提交于 2019-12-13 05:24:16
问题 I am trying to create a dynamic query in LinqPad with PredicateBuilder enabled. I first create a string that corresponds to the where clause for a query like '(orderid >100 AND customerid<=100)' and then try to use this string in building a LINQ query with PredicateBuilder. The dynamic query is represented by the variable 'dynamicResult' in code give at end of this post. The query is on Orders table of Northwind database in SQL Server 2008 R2. The query throws this error in LinqPad, when I

Querying using subqueries on a SQLite database approx 10x slower using newer versions of System.Data.SQLite/sqlite3.dll

半世苍凉 提交于 2019-12-13 03:39:38
问题 (See update below) I am having an issue of slow query performance when querying a very simplistic Sqlite datatable of about 500,000 rows from within a C#.Net application (~5sec). I have tried the exact same query on exactly the same database using LinqPad, as well as 2 database browsers (both based on QtSql), and it runs 10x faster (~0.5secs). Same query, same db, different apps, only mine doesn't run fast. It makes negligible difference whether I'm returning values or just a Count(*). I've

LinqPad just crashed on me. Is my code anywhere on the disk?

孤者浪人 提交于 2019-12-12 10:53:52
问题 I crashed LinqPad while crafting something slightly less than trivial. I don't want to restart it until I'm sure that won't jeopardise recovering my work (if this is possible). My question is: Does LinqPad write temp files anyware that might still contain the code I wrote? For posterity, here's a test case that crashes LinqPad every time (also posted to LinqPad forum): void Main() { Crasher.Crash(); } class Crasher { public static void Crash() { var a=0; Crash(); a++; //let's get something in

Cancel a LinqPad query while it renders

牧云@^-^@ 提交于 2019-12-12 02:46:09
问题 Every now and then when I write LinqPad queries I forget how complex some of my database objects are. This can result in a query that runs quickly (< 5 secs) but then takes longer (>5 mins) to render the results to the output window. While this is happening the entire LinqPad UI becomes unresponsive. You can cancel a query before it returns from the DB using the 'stop' button, but is there a way to cancel the rendering of the result set if I feel that it is taking too long? I thought that if

LinqPad Test Looks For Correct DB But Queries Wrong One

会有一股神秘感。 提交于 2019-12-11 18:15:46
问题 I have created a connection in LINQPad that uses a project's EfDBContext. After some recent issues I can now get it to query a table, but when it does it created a whole new schema. So, when creating the connection (Entity Framework POCO Connection), when I click "Test" the Profiler shows me: SELECT Count(*) FROM sys.databases WHERE [name]=N'mydatabase' But when I run Ethnicities.Take (100) I see: SELECT Count(*) FROM sys.databases WHERE [name]=N'UserQuery' Followed by all the commands to