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. General Programming
  3. LINQ
  4. LinqToSQL unit test in .NET error

LinqToSQL unit test in .NET error

Scheduled Pinned Locked Moved LINQ
helptestingquestioncsharpbeta-testing
2 Posts 1 Posters 3 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.
  • S Offline
    S Offline
    Steve Holdorf
    wrote on last edited by
    #1

    I am doing unit testing with .NET 3.5. Our data layer is made up of a LinqToSQL model (Similar to enitity framework). We are creating objects "Person object" based on the search stored procedures of the LinqToSQL model. The stored procedures all get their data from data views. The tables these views are made from have id's but they are not primary identity keys. Now, in my unit testing I get a DataContext object from the LinqToSQL model and call the search methods for the Person object. The bug is that when the dataContext makes the dataContext.SearchPerson(...) call I get an error indicating that the data tables the views are made up from don't have primary identity keys. At this point in our development we can not set the table id's as primary identity keys. Has anyone experenced this type of problem and what is a good solution? Thanks, Steve Holdorf

    S 1 Reply Last reply
    0
    • S Steve Holdorf

      I am doing unit testing with .NET 3.5. Our data layer is made up of a LinqToSQL model (Similar to enitity framework). We are creating objects "Person object" based on the search stored procedures of the LinqToSQL model. The stored procedures all get their data from data views. The tables these views are made from have id's but they are not primary identity keys. Now, in my unit testing I get a DataContext object from the LinqToSQL model and call the search methods for the Person object. The bug is that when the dataContext makes the dataContext.SearchPerson(...) call I get an error indicating that the data tables the views are made up from don't have primary identity keys. At this point in our development we can not set the table id's as primary identity keys. Has anyone experenced this type of problem and what is a good solution? Thanks, Steve Holdorf

      S Offline
      S Offline
      Steve Holdorf
      wrote on last edited by
      #2

      I got this one fix. In the LinqToSQL model (vsmdi file) I set the property for the contactId Identity = true. Thanks, Steve Holdorf

      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