I added a LinqToSQL Class to my project and put it in my App_code folder.
I then added a LinqDataSource to a new web page and tried to configure it to use this class, but it does not show up as an option in the DataContext drop down.
I moved the class to the root directory of my project and it is now available in the DataContext drop down box.
I created a new project with 1 page and tried it again and still the same thing. If the class isn't in my root directory it isn't available.
I have searched the internet and everything I have found indicates that the class should be in my App_code folder, but it doesn't work if I put it there.
Does anyone know why the class isn't available if I put it in the App_code folder.
Thank You
I created a new local installation of my website and then opened it in VS 2010, and this time it saw the Data Context. It means you have to debug your project first, then you will see the Data Context.
.dbml
file in VS2010 and make sure that it only has the tables in it that are related to what you are doing with the .dbml
file. I opened my to discover I had taken 3 tables when all I needed was one..dbml
file, and expand it.<name-of-your-dbml-file>.dbml.layout
, and <name-of-your-dbml-file>.designer.cs
<name-of-your-dbml-file>.designer.cs
to open it.using <the-name-space-from-step-four>
LinqDataSource
LINQDataSource Tasks
, and click Configure Data Source...
Show only DataContext objects
is unchecked.Choose your context object:
dropdown look for the namespace we noted in step 4.From there you should be able to select your DataContext class and click next.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With