Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Sanity Check : Anyone doing Linq to SQL under 4.0 framework and WCF?

Sanity Check : Anyone doing Linq to SQL under 4.0 framework and WCF?

Scheduled Pinned Locked Moved Database
csharpdatabasewcflinqdebugging
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Michael Eber
    wrote on last edited by
    #1

    I converted my 2008 / .NET 2.0 data service to VS2010 with the 4.0 framework. I can do my normal test: http://localhost:4440/datareflector.svc and I get my wsdl screen. If I click the link I get all of my WSDL as expected. So nothing is wrong there. My data structure uses Linq to Sql to connect to he database and extract information. The applications' service reference has all of the data in it correctly. When I call the service I get a report that the service terminated. When I attach my code to the service and enter debug the results totally floor me: my code pattern is simple:

    public things\[\] GetMyThings( Guid myIdentity )
    {
       using ( MyContext context = new MyContext( connectionString ) )
       {
            var mt = from t in context.ThingTable
                where t.Identity == myIdentity
                select t;
            return mt.ToArray();
       }
    }\*
    

    When I walk through this simplistic code, I can confirm that mt ends up populated with the rows and values expected and goes through the return code just fine. At the end of the walk (the bracket marked with the *) when I hit F11 I get the exception InvalidOperationException ' Attempting to access an object (context) that has been disposed. ' I cannot, for the life of me, figure this one out. About to wipe my machine and do a full reinstall just to see if that cleans up everything. This is an issue no one seems to have an answer for. Has ANYONE experienced this kind of issue?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups