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. C#
  4. Class Libraries and Web References

Class Libraries and Web References

Scheduled Pinned Locked Moved C#
csharpsysadminquestion
3 Posts 2 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.
  • C Offline
    C Offline
    caksabre2
    wrote on last edited by
    #1

    Hello, I have two C# Applications one client side, one server side, which communicate via a web service that I am creating also. I wanted to create a class library so that classes that are used between the three applications can be re-used. I want to allow one of the webmethods in the web service to accept an object of one of the classes I have created in the class library but when I try and pass it from either application it says I can't because the types are different. ABSWebService.Market doesn't equal ABSClassLibrary.Market (Event though in the web service it is referencing the Class Library to get the Market). I have tried to cast it to the other type, but this isn't allowed either. Any suggestions?

    J 1 Reply Last reply
    0
    • C caksabre2

      Hello, I have two C# Applications one client side, one server side, which communicate via a web service that I am creating also. I wanted to create a class library so that classes that are used between the three applications can be re-used. I want to allow one of the webmethods in the web service to accept an object of one of the classes I have created in the class library but when I try and pass it from either application it says I can't because the types are different. ABSWebService.Market doesn't equal ABSClassLibrary.Market (Event though in the web service it is referencing the Class Library to get the Market). I have tried to cast it to the other type, but this isn't allowed either. Any suggestions?

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      If you are using a WCF Service, when you add the service reference there is a setting for "Re-use classes in referenced assemblies". If you're using old-fashioned web methods I think you're S.O.L.

      C 1 Reply Last reply
      0
      • J J4amieC

        If you are using a WCF Service, when you add the service reference there is a setting for "Re-use classes in referenced assemblies". If you're using old-fashioned web methods I think you're S.O.L.

        C Offline
        C Offline
        caksabre2
        wrote on last edited by
        #3

        Well I have only just started creating this, so I was using Web Services as that is what I know. But if it will work with WCF I will try that instead. Just to add to the complexity the class library needs to be able to access another external web service that isn't mine, and all the applications need to create and pass objects of this web service type. Should I just forget Class Libraries?

        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