Quantcast
Channel: LINQPad Forum
Viewing all 2658 articles
Browse latest View live

Compile LINQPad query (under C# Program-mode) into a standalone dll

$
0
0
Just curious that is there any way to find or compile the query (C# statements / programs) into a standalone dll.

There are times where I would like to create a new class in LINQPad, and export it as a dll.
e.g.

public class MyClass
{
private string _Name;
public string Name { get { return this._Name; } set { this._Name = value; } }
}

I wish to be able to export it as a dll on the fly.

Missing Imported Reference

$
0
0
Hi everybody,
I am trying to do a simple conversion of a source Data file to stream via LINQPad and this error is displayed when i compile the code:'System.Array' does not contain a definition for 'ToPointStream' and no extension method 'ToPointStream' accepting a first argument of type 'System.Array' could be found (press F4 to add a using directive or assembly reference). Does anybody know which assmebly reference should i add and where can i find it? Thank you in advance.
Best Regards,
Mark

Result in full screen?

$
0
0
Having a surface Pro, and a wireless connection at work, LINQPad is once again showing its strengths.
However, this use quickly uncovered a new caveat. I would like to execute a query and hand the device over to someone who can look at the output window. The touch interface is not optimal for quick resizing of the result window. Sometimes they are confused by the LINQPad UI (when they should be looking at the result pane only). Sometimes they fat finger it, especially when the device is passed from one individual to another) accidentally jumping to another query and such.

Is it possible to have a full sceen mode of the result window which is suitable for non-LINQPad users to browse the results?

The result output can often be lengthy. In time, it would also be cool if LINQPad result window would offer a navigatable table of contents in a left pane. The name of the chapters/sections could the input string to the Dump() command.

IQ Driver - Oracle Connection Setup

$
0
0
My oracle instance uses a Service Name. I can't figure out how/where to input this information into the connection setup tool. Do I need to add something into the "Additional connection string options" box? For reference i've included an example of the connection string i am using in my application's web.config.

"Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = [IP Address])(PORT = [Port]))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = [Service Name])));User Id=[name];Password=[password];"

Why doesn't the AnyCPU build ship with the installer?

$
0
0
I'm curious to know why the AnyCPU build of LINQPad isn't the default version that ships with the installer.

It seems like it would be easier to only support and publish one build. Also I would generally hope for a small speed boost in native x64 code, thanks to the extra CPU registers.

But, it's very clear that you know what you're doing, so I assume there's a good reason for your choice of default. What are the advantages to having a 32-bit build be the default option for the "installer" version of LINQPad?

Required permissions LinqPad Object Explorer

$
0
0
When I point LinqPad at my dev server, where I am dbo, my tables show with primary keys and references.

When I point LinqPad at my prod server, where I only have db_reader and db_writer, my tables say "Warning: No primary key, updates will fail" and show no references.

What permissions does LinqPad Object Explorer need to enumerate the tables completely? With SQL Server Management Studio, I can see the complete table definitions in SSMS Object Explorer pointed at either server.

This is for SQL Server 2008 R2 and LinqPad 4.43.06 Premium Edition.

Problem attaching Nutshell.mdf

$
0
0
Error 15350: An attempt to attach an auto-named database for file C:\Users\foo\AppData\Roaming\LINQPad\Nutshell.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

But there's not an existing db byt that name. I've copied the mdf to the native sql folder (C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA) so perms shouldn't be an issue. Unable to attach using SMSS's 'Attach MDF' function. The 'message column' for more details insists there is an existing db by the same name.

LinqPad _is able to create a db on my local 2012 Dev edition server via 'new connection'.

The sample db comes via the 4.43.06 (registered) installer. Am hitting:
Microsoft SQL Server 2012 - 11.0.2100.60 (X64)
Feb 10 2012 19:39:15
Copyright (c) Microsoft Corporation
Developer Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1)


looking forward to hearing of troubleshooting procedures.

thx

InvalidCastException with anonymous classes with custom driver

$
0
0
I have a custom driver implementation and I get an InvalidCastException when using anonymous classes. Say I have the following query:

from product in Products
select new { Name1 = product.Name }

This works OK. Now, I run the following query (the name of the first property is different):

from product in Products
select new { Name2 = product.Name }

Now I get the following exception:

InvalidCastException: Unable to cast object of type 'System.Linq.EnumerableQuery`1[<>f__AnonymousType0`1[System.String]]' to type 'System.Collections.Generic.IEnumerable`1[<>f__AnonymousType0`1[System.String]]'.

When I change the number of properties of the anonymous type, the exception goes away (I think this is due to the anonymous type being names f__AnonymousType0`2; if I then again change the name of one of the properties, the exception occurs again).

I do not get this exception when I use the LINQ to SQL driver so I guess I'm doing something wrong in my driver. How can I solve this?

Get nothing in the SQL window

$
0
0
Hi,
I have a problem with a connection using a "EF DbContext (4.1,4.2,4.3,5.0)" context.
When I'm executing a "C# expression" like "from a in AreaCounties select a", I got all the records in then Results window BUT i can't see anything in the SQL window. It's just grayed out.
I know I had this working earlier, before updated to Premium, but don't know if it has someting to do with that.
I'm on version 4.43.06

Is it possible to include code from one .linq file in a different .linq file during compilation?

$
0
0
I'm interested in building some diagnostic tools around LinqPad.

The idea being we would have a library of different .linq files for different purposes.
Like any good engineer's we would like to be able to reduce code duplication if possible.

I would like to be able to factor out different parts of the code we would call into seperate .linq files and be able to later #include or something equivelant to have the code in that file included in compilation with my current "query".

I realize we could factor this common code into a library which we include in our queries, however I'm still interested if the above is possible?

why the store procedures have not shown up in your lingpad?

$
0
0
hi, I have a question about your linqpad. why I can not load store procedure to your lingpad.

for example, in Visual studio. I have a AccountingModelContext class.
in the class,

there is one DBSET Accountlists.( it is a table from Sql server database).

there are two store procedure AccountList_GetNumber, AccountList_GetTransactionsDetailByDate.

then, in your lingpad, I add connection, and load this Dll to your linqpad.

but only show the accountlists table out at your left hand toolpanel.
the two store procedures have not shown up.

why the store procedures have not shown up?



public class AccountingModelContext : System.Data.Entity.DbContext
{
public AccountingModelContext(string connectionString)
: base(connectionString)
{ }


public DbSet AccountLists { get; set; }

public virtual ObjectResult AccountList_GetNumber(string accountType, string accountNumber, string subType)

[EdmFunction("Q6ModelEntities", "AccountList_GetTransactionsDetailByDate")]
public virtual IQueryable AccountList_GetTransactionsDetailByDate(string dtStartDate, string dtEndDate)

Translating Query-Based to Method-Based Not Working

$
0
0
Greetings,

I would expect the following lines of code to result in a method-based translation when clicking on the lambda button in LINQPad; however, I do not see anything. Is there a reason for this? I am running the Premium version of LP on Windows 8.

var files = Directory.GetFiles(@"C:\Windows", "*.*", SearchOption.TopDirectoryOnly);

var query = from f in files
//where f.Contains("bootstat")
select new { FileName = f };

foreach (var s in query)
{
Console.WriteLine(s.FileName);
}

Thanks in advance!

Raymond

LinqPad custom plugin: extension method not found

$
0
0
Hi, first time poster here.
I've been trying to write a simple plugin for LinqPad (currently running v4.45.05 PRO), but LinqPad doesn't detect my extension methods.

I've written a simple VS project, which references LinqPad.AnyCPU, with one class which looks like this:

public static class Extensions
{
public static void ShowCustomVisualization(this List<double> valueList)
{
var c = new CustomDisplay(valueList);
PanelManager.DisplayWpfElement(c, "CustomDisplay");
}
}
This project is built in Release mode, and copied to My Documents\LinqPad Plugins, which was created by LinqPad.
The project references another dll, which contains some logic for displaying, and that dll is also copied to the Plugins folder.

However, when I write a simple piece of code like this in LinqPad:
var d = new List<double>{1,2,3,4,5,6,7,8};
d.ShowCustomVisualization();
It does not find the extension method.

Yes, I've tried "turning it off and on again" :-) I've also tried to create different signatures for the extension method.

Doe anyone have any idea what I'm doing wrong?
Thanks!

Util.HighLight returning the passed type?

$
0
0
Could the HighLight (and HighLightIf) function return (the passed type) instead of "object" (LINQPad.ObjectGraph.Highlight)? From my layman POV, one way to achieve this would be for LINQPad to maintain a per execution static hashset of weak references to all objects highlighted (and associated HighLightIf predicates).
The Dump() command would then inspect this hashset during processing to see if a reference being processed has been marked for highlighting.
This is certainly not a biggie, but the natural flow that you get used to with Dump() (returning Enumerable) is not there with HighLight, and the resulting Anonymous Types are hard to process further (transform/sort/group).

Wish: Use Ctrl-W to close current query window

$
0
0
This is one I use in browsers, and I configure Visual Studio to use this shortcut.
I Would very much like to see this one in LinqPad as it would be a time saver when working with multiple queries at the same time.

Drill down - via link in query output

$
0
0
I could swear I have read about a way to create a hyperlink in query output that when clicked will execute a second query. Am looking to create a drill down type of functionality.

My attempts to find in this forum some hints to method calls, etc. are not getting me any place. My ego with respect to my prowess in searching forums is taking a hit this morning.

Can anyone help me out?

How I can cross using the entitties from different context dll together

$
0
0
hi,
I have add different connections in Linqpad. for example, accountingContext, companyContext.
How I can cross using the entitties from different context dll together.

it always shows some entity "does not exist in the current context"

my version of Linqpad is paid premium version of Lingpad.

Could LinqPad detects modification made to a query from outside the IDE and reload it?

$
0
0
Hi, I had a crazy idea to include/reference others .linq queries.

When I want to include a query I create an empty region using the convention #region Include .

Then I have a console app watching all my queries for changes, it finds the #region Include ... pattern and try to resolve all the dependencies, and finally merge the code, references and namespaces.

It's not perfect but it's working just fine anyway.

Now the only thing is LinqPad doesn't detect that an already opened query has been changed a disk so it won't ask me the reload it (like what you see in VS, Notepad++ and other IDEs).

Could this feature be added to LinqPad?

C# Expression - executes twice?

$
0
0
Try it....

(from x in Enumerable.Range(0, 5) select x).Dump()

By design? Difficult for me to image that it would be.

Am using a beta (v 4.44.09)... perhaps an oversight.

Util.WriteCsv

$
0
0
can't pass a data table build in memory. Looks like a nice feature, I've created my own in the past to convert a datatable to CSV, but still when doing prototype in LinqPad, would be nice to use just
Util.WriteCsv (DT, "c:\out.csv")
thanks
Viewing all 2658 articles
Browse latest View live