3

I originally had a project that I use as a connection to my database but the issue is that when I added a new table that I just created to the dbml file via dragging the table from Server Explorer it seems to work but doesn't. Instead it just throws an error.

Code

 PIMDataContext dbContext = new PIMDataContext();
        foreach (var thing in dbContext.Product_NewProduct_Xrefs)
            Console.WriteLine(thing.ProductNumber);
        Console.Read();

PIM.dbml (the dbml I edited also the dbml the context above refers to)

enter image description here

And finally here is the error

Method not found: 'System.Data.Linq.Table`1<PIM_DATA.Product_NewProduct_Xref> PIM_DATA.PIMDataContext.get_Product_NewProduct_Xrefs()'.

What I checked already,

  • Rebuild
  • Restart VS2012
  • Re-Import Database project
  • Delete References and Re-add references
Ya Wang
  • 1,758
  • 1
  • 19
  • 41
  • did you Refresh it ..? also I recall VS having an issue with this do you have a backup of the original one.. when you add it it removes from what I can remember 2 or 3 using statements from the hear in the .cs file .. read this link as well for the steps to `Refresh .dbml` file http://stackoverflow.com/questions/1110171/how-to-update-linq-to-sql-dbml-file – MethodMan Feb 05 '16 at 20:34
  • Well I added a whole table to the dbml file so I see no reason why it wouldn't refresh. I just set a property to nullable and saved rebuilt and renulled it then rebuilt and still same error as well – Ya Wang Feb 05 '16 at 20:39
  • Is it possible the database project is not really getting rebuilt? Or that its getting rebuilt in debug configuration, and your main project references the Release dll? – Benjamin Feb 05 '16 at 22:19
  • Try to find out who calls get_Product_NewProduct_Xrefs, I do not think linq2sql should generate that. – Antonín Lejsek Feb 06 '16 at 03:12

1 Answers1

0

Ended up deleting the whole connection to db. Re-inputing the connection details and recreating the whole dbml file.

Ya Wang
  • 1,758
  • 1
  • 19
  • 41