C# 3.0 in a Nutshell
C# 3.0 in a Nutshell, Third Edition A Desktop Quick Reference By Joseph Albahari, Ben Albahari
September 2007
Pages: 858


Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Use Custom Dbml With Linqpad
shiatsuPete
post Jul 1 2009, 05:55 AM
Post #1


New Member
*

Group: Members
Posts: 4
Joined: 1-July 09
Member No.: 18,961



I'm working on a project which references an existing database, which has no foreign keys defined, and which I can't amend in case it causes problems with the existing application. I have therefore created a custom dbml file within my asp.net website, where I have added associations between the tables.

I would like to use linqpad in order to test and develop queries, but I can't figure out how to reference the dbml file from linqpad. There is no dll in the website or project folders, so I am not sure how to reference the assembly.

Any help would be greatly appreciated.

Pete
Go to the top of the page
 
+Quote Post
JoeAlbahari
post Jul 1 2009, 07:48 PM
Post #2


Advanced Member
******

Group: Members
Posts: 207
Joined: 15-February 08
From: Perth, Australia
Member No.: 90



Hi Pete

You need to create a DLL that LINQPad can reference.

This happens automatically if you create a web application (rather than a web site).

But obviously, you're not going to want to change your solution structure just for LINQPad! So a workaround is to create an additional project (of type class library) and add just the .dbml and associated files to the project. You can put this project in a separate directory if you want, and then add the .dbml and associated items as shortcuts.

Once you have a DLL, it's easy to consume it in LINQPad. The procedure is the same as for Entity Framework:
http://www.linqpad.net/EntityFramework.aspx

Joe
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

RSS Lo-Fi Version Time is now: 7th November 2009 - 05:17 PM