473,325 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Linq to SQL Issues

Hi,

I'm having a bit of trouble with the DataContext class that was generated when I dragged
tables from my database into the Linq to SQL designer. The problem is that no code is
generated for the DataContext class. All that's generated is an empty partial class with
nothing in it.

Is there supposed to be code in this class or must I manually put code in it? I thought
the DataContext class automatically generated code based on the tables I supplied. What
gives? :(

Roshawn
Jun 27 '08 #1
2 892

"Roshawn" <ra*********@yahoo.comwrote in message
news:Ok**************@TK2MSFTNGP06.phx.gbl...
Hi,

I'm having a bit of trouble with the DataContext class that was generated
when I dragged tables from my database into the Linq to SQL designer. The
problem is that no code is generated for the DataContext class. All
that's generated is an empty partial class with nothing in it.

Is there supposed to be code in this class or must I manually put code in
it? I thought the DataContext class automatically generated code based on
the tables I supplied. What gives? :(

Roshawn
Just looked at one in one of my projects.

In the datacontext class there are
#Region "Extensibility Method Definitions"

followed by Partial Private Sub's with no code?

If you are missing those then you need to ensure that primary keys exist for
each table you want in the datacontext.

Only other code is about 5 New subs.

LS

Jun 27 '08 #2
Lloyd, thanks for the reply.

I had to look a little closer to find the file that actually contained some code. In the
Linq to SQL designer, I just right-clicked the background or one of the entity tables and
selected "View Code," which then brought up the .vb file. Only partial class declarations
for each table/entity I'm working with appeared and nothing more.

Fortunately, I found the *.designer.vb file which had actual code for the DataContext
object. Also there's code for the entities I'm working with.

Thanks again for your help. Now it's on to testing.
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: =?Utf-8?B?V2lsc29uIEMuSy4gTmc=?= | last post by:
Hi Experts, I am doing a prototype of providing data access (read, write & search) through Web Service. We observed that the data storing in SQL Server 2005, the memory size is always within...
4
by: BeSharp | last post by:
I recently stumbled across a pretty interesting LINQ to SQL question and wonder, whether anybody might have an answer. (I'm doing quite some increasing LINQ evangelism down here in Germany.). ...
7
by: Adrian | last post by:
Hi, I'm trying to add caching to our asp app, but am having problems with the SQLCacheDependancy not invalidating the cache when the table changes. Using vs2008, sqlserver 2005 developer edition....
4
by: =?Utf-8?B?RXJpYyBGYWxza2Vu?= | last post by:
We’re storing our main entity in an insert only table which stores the history of past revisions, but we’re facing problems with storing this history as LINQ will only update the entity, and...
3
by: =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post by:
I'm attempting to use LINQ to insert a record into a child table and I'm receiving a "Specified cast is not valid" error that has something to do w/ the keys involved. The stack trace is: ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.