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. Returning Linq queries from wcf.

Returning Linq queries from wcf.

Scheduled Pinned Locked Moved LINQ
csharpdatabasequestionsql-serverwcf
3 Posts 2 Posters 5 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.
  • D Offline
    D Offline
    Daniel Skibinski
    wrote on last edited by
    #1

    Hello, I'm writing a system where the client application communicates with a wcf-service, and the service in turn uses LinqToSQL to get data from a Sql Server. I want to return the query result back to the client, but to do this I have to define the datacontract. I haven't found a way to do this in the designer. My question is, is it possible to somehow add the attributes from the designer? Adding it manually in the generated code isn't a good solution.

    J 1 Reply Last reply
    0
    • D Daniel Skibinski

      Hello, I'm writing a system where the client application communicates with a wcf-service, and the service in turn uses LinqToSQL to get data from a Sql Server. I want to return the query result back to the client, but to do this I have to define the datacontract. I haven't found a way to do this in the designer. My question is, is it possible to somehow add the attributes from the designer? Adding it manually in the generated code isn't a good solution.

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      The objects generated from the designer are partial classes defined in 2 classes. Part of the class is defined in the generated code side, the other part of the class is all yours: e.g. MyObject.cs <-- put the [DataContract] attribute in this code file MyObject.Designer.cs <--- this one is auto-generated

      D 1 Reply Last reply
      0
      • J Judah Gabriel Himango

        The objects generated from the designer are partial classes defined in 2 classes. Part of the class is defined in the generated code side, the other part of the class is all yours: e.g. MyObject.cs <-- put the [DataContract] attribute in this code file MyObject.Designer.cs <--- this one is auto-generated

        D Offline
        D Offline
        Daniel Skibinski
        wrote on last edited by
        #3

        I found yet another way @ http://blogs.msdn.com/kaevans/archive/2007/09/03/wcf-and-linq.aspx. "Click on the designer surface in your .dbml file and change the Serialization property to "Unidirectional". That will decorate the generated classes with DataContract and DataMember attributes appropriately."

        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