linqpad

Evaluate “image” SQL column in a query

让人想犯罪 __ 提交于 2019-12-11 16:52:58
问题 I have a database containing a table with an "Image" colum: This column actually contains a long string encoded as HEX byte values. I need to select all records where the string encoded by this column contains a certain substring. Pseudocode would be: Select * From SomeTable Where dataColumnofTypeImage.ToString().Contains("somesubstring") I tried to do this in Linq (LinqPad) using: from z in Zanus let p = z.Udata.ToArray() // z.Udata will be of type System.Linq.Binary so I want to make a byte

Cancel LINQPad program run

自闭症网瘾萝莉.ら 提交于 2019-12-11 11:17:40
问题 Is it possible to cancel long running programs that I run in LINQPad? If so, how? Edit: LINQPad can become unresponsive for a long time when displaying very big objects. Then you either have to wait or kill LINQPad. This does not happen in general when running programs that run for a long time. 回答1: In my experience there are two main phases where LINQPad might spend significant time when executing your query: while executing the query against the data context and gathering the data while

Cannot open sqlite database with linqpad, when WITHOUT ROWID is used

孤者浪人 提交于 2019-12-11 09:16:44
问题 I cannot open a sqlite database with linqpad, when WITHOUT ROWID is used. Is there a workaround? A newer versions? Are there sources for the "IQ Driver - for MySQL, SQLite, Oracle" so that I can recompile with a more current sqlite3? 回答1: (Too late, replying just for "Google airlines landings") It looks like standard SQLite in Android doesn't support this option. A custom compiled SQLite works properly, but it requires lot of work. See related post: SQLite "WITHOUT ROWID" supported on Android

Linq2SQL: Select only some columns, but still able to submit changes

大城市里の小女人 提交于 2019-12-11 09:04:47
问题 I need to update a column in a table which contains a lot of rows. Each row has a some large TEXT columns in it, which i do not need for my update. I'm using LinqPAD, and this is roughly, what i wanna do: (from s in Table where s.FK_ID == null select new{s.FK_ID, s.Datum, s.PBNummer}).ToList() .ForEach(s => s.FK_ID = new Guid(...some new guid here...)); SubmitChanges(); This does not compile, as the properties of an anonymous class type are read-only. If I do (from s in Table where s.FK_ID ==

High Level Function Confusion with Lambda/LINQ expressions in C#

六月ゝ 毕业季﹏ 提交于 2019-12-11 05:28:15
问题 Unsure how to describe this question so the title might be wrong. Am reading over some code examples and am confused over the following return function: Func<Func<int , bool>, Func<int , int>, Func<int , int>> Loop = null ; Loop = (c , f ) => n => c(n) ? Loop(c , f ) ( f (n)): n; Func<int , int> w = Loop(n => n < 10 , n => n + 2); var r = w(2); var s = w(3); Console . WriteLine ("{0} {1}" , r , s ); I understand that this function is returning the Loop when c(n) evaluates to true, but I don't

Call WCF service with issued token

荒凉一梦 提交于 2019-12-11 05:18:21
问题 I attempt the following: A WCF client calls a STS and gets SAML assertion The client calls a service using the SAML assertion Now I have implemented the scenario above as three LinqPad scripts: client.linq , sts.linq (self hosted WCF service) and service.linq (self hosted WCF service). They can all be found at https://github.com/codeape2/WCF_STS I need some help getting this to work. Using the following code in client.linq , I am able to call my STS and get a SAML assertion: SecurityToken

LinqPad queries __MigrationHistory on first run of an EF query

梦想与她 提交于 2019-12-11 04:34:20
问题 My project is EF 5, using DbContext. I just noticed that the first time I run any Linq query in LinqPad, there is a slight delay, and the generated SQL starts with the following. The subsequent runs, there is no delay and no extra SQL. Can anyone explain to me what this SQL is, and if I should worry about it? SELECT TABLE_SCHEMA SchemaName, TABLE_NAME Name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' GO SELECT [GroupBy1].[A1] AS [C1] FROM ( SELECT COUNT(1) AS [A1] FROM [dbo]

In LinqPad, is there a way to serialize type XML column as string?

泄露秘密 提交于 2019-12-10 18:25:35
问题 I have a XML column on SQL. And there are malformed data exist in it. Which causes the error "There are multiple root elements." when I run MyTable.Take(4).Dump(); e.g. <cy> <n>NameA</n> <p>true</p> </cy> <cy> <n>NameB</n> <p>false</p> </cy> Is there a way to tell LinQPad to not serialize XML column and provide it as a string? Unfortunately data is tied up with many places so I can not wrap it with root element on database right away. 回答1: The latest LINQPad beta, version 5.10.06, allows you

how can I 'walk' the relationships between tables in LINQ?

十年热恋 提交于 2019-12-10 15:59:24
问题 Let's say I have three tables: Office ID SalespeopleOffice ID OfficeID PersonID People ID ManagerID In LINQ to SQL, how can I start from the SalespeopleOffices table and "walk" from that table to the People table or the Office table via the relationships between the tables? Specifically without knowing what those relationships are; pull the data about the relationships instead of interacting with the objects directly. I'm looking for a way to programatically analyze table relationships. The

Why does LINQPad dump enum integer values as strings?

橙三吉。 提交于 2019-12-10 12:33:38
问题 I was using LinqPad to test out some Enum functions and I didn't get integers like I expected when I used .Dump(). Why did the ToList() solve the problem? void Main() { Enum.GetValues(typeof(Options)).Cast<int>().Dump(); Enum.GetValues(typeof(Options)).Cast<int>().ToList().Dump(); } public enum Options { Equal, LessThan, GreaterThan } 回答1: Actually, LINQPad is not the culprit here. This is because of an optimization in Enumerable.Cast: public static IEnumerable<TResult> Cast<TResult>(this