SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru Chroniclemaster1's Avatar
    Join Date
    Jun 2007
    Location
    San Diego, CA
    Posts
    784
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LINQ object not executing it's interface?

    I switched laptops at work and had to recreate the test database for one of my projects. No problem. I dragged the DB table back over into my LINQ designer, but now when I run my code...

    testcmsDataContext db = new testcmsDataContext();
    IQueryable<cmschange> query = db.cmschanges;

    I'm getting a bizarre error.

    CS0029: Cannot implicitly convert type 'System.Data.Linq.Table<LINQDAL.CmsChanges.cmschange>' to 'System.Linq.IQueryable<cmschange>'

    I've tried working around this, but without success, and not only was this code (and two others apps) working beautifully before, Table<TEntity> implements IQueryable<TEntity>. There shouldn't be a problem here.

    Several blogs and forums pointed out import problems but I'm using System.Linq, System.Data.Linq, and System.Linq.Dynamic.
    Whatever you can do or dream you can, begin it.
    Boldness has genius, power and magic in it. Begin it now.

    Chroniclemaster1, Founder of Earth Chronicle
    A Growing History of our Planet, by our Planet, for our Planet.

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,623
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Did the new regeneration kill your namespaces?

    [this is why we source control the generated files too]

  3. #3
    SitePoint Guru Chroniclemaster1's Avatar
    Join Date
    Jun 2007
    Location
    San Diego, CA
    Posts
    784
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Exactly right. I set up SQL Server created the DB, and upgraded my namespaces to make it easier to transition new iterations from test to production. However, I had so many problems configuring SQL Server (it took a couple weeks, two installs, a and hard drive reformat), that I forgot I'd made that change. The original dbml was in App_Code, so it was still accessible. I rebuilt the production code to run from LINQDAL.CmsChanges, deleted the files in App_Code and then the test files were no longer confused.
    Whatever you can do or dream you can, begin it.
    Boldness has genius, power and magic in it. Begin it now.

    Chroniclemaster1, Founder of Earth Chronicle
    A Growing History of our Planet, by our Planet, for our Planet.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •