Akos Nagy
Akos Nagy

Reputation: 4359

Grouping multiple LinqPad data context connections

I have a data source for which I would like to build a LinqPad data context driver. The structure of the data source is fairly simple to that of relational database servers: I too have a "server", which can manage multiple "databases", which can include "tables".

I have read the available documentation and checked out the sample here, and I have been able to create the driver.

However, when I connect more time to different "databases" on the same "server", they show up under a new item in the tree, like this:

I would like to mimic the way the Default (LINQ to SQL) built-in provider works, which has an option to create multiple connections, using the "Display all in a Treeview" option:

Which results in one treenode for the server, and if I expand the treenode, I have all the databases:

I do believe that these are actually different connections, because they show up in the connection selection drop-down as different items.

I tried to point the connection to the "server" instead of the "database", querying all the "databases". The problem with this approach is that in this case only one typed datacontext is created, but I need one for each of my "databases", because the actual name of the "database" is an argument that my context needs, so that it can access the data (and since EF DbContexts also need the database name in the connection string, I'm pretty sure that the connections in my last picture each have a different context just for themselves with their specific connection string also).

I also looked through the API as much as I could just to see if I can "attach" the new node to an existing node in the tree, but I don't see any API for querying the existing items.

Is there any way to do this, or this requires some internal APIs?

Upvotes: 0

Views: 507

Answers (1)

Joe Albahari
Joe Albahari

Reputation: 30984

Unfortunately, this cannot be done through the extensibility model. Right now it relies on internal APIs.

Upvotes: 1

Related Questions