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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. WPF
  4. Service Model

Service Model

Scheduled Pinned Locked Moved WPF
csharpquestionasp-netwcfannouncement
5 Posts 3 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
    mehrdadc48
    wrote on last edited by
    #1

    Hi, what is the best model for using services in a silverlight application? I usualy add a wcf service to my ASP.net app and add a service refrence to my silverlight application, but anytime I change my service I should update the service refrence in silverlight app. Is there any better and more proffessional way?

    Best wishes

    M 1 Reply Last reply
    0
    • M mehrdadc48

      Hi, what is the best model for using services in a silverlight application? I usualy add a wcf service to my ASP.net app and add a service refrence to my silverlight application, but anytime I change my service I should update the service refrence in silverlight app. Is there any better and more proffessional way?

      Best wishes

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      mehrdadc48 wrote:

      Is there any better and more proffessional way

      I'm gonna be interested in reponses to this one, I see no other alternative to updating the service reference whenever you change the service. I do take exception to having my method called unprofessional :mad:

      Never underestimate the power of human stupidity RAH

      S 1 Reply Last reply
      0
      • M Mycroft Holmes

        mehrdadc48 wrote:

        Is there any better and more proffessional way

        I'm gonna be interested in reponses to this one, I see no other alternative to updating the service reference whenever you change the service. I do take exception to having my method called unprofessional :mad:

        Never underestimate the power of human stupidity RAH

        S Offline
        S Offline
        Simon Bang Terkildsen
        wrote on last edited by
        #3

        If you can reference an assembly with your service interface and any types you might use. Then you can use the ChannelFactory

        ChannelFactory factory = new ChannelFactory()
        IService myService = factory.CreateChannel();
        myService.Foo();

        the drawback is you don't have any auto generated code so if you need asynchronous calls then you'll have to write that yourself. If you need the auto generated code, then I suppose you could use svcutil in the post build event of your service project. eg.

        svcutil "http://localhost:1892/IMyService.svc" /out:OutputDir\MyService.cs

        This however requires that you have an ISS running with a site that has your service's output directory as it's Content directory. Also you proporbly have some kind of source control so you might want to add some lines before the above line so that MyService.cs is checked out before svcutil overwrites it. That's the only two way I know of to avoiding having to update the service reference.

        M 1 Reply Last reply
        0
        • S Simon Bang Terkildsen

          If you can reference an assembly with your service interface and any types you might use. Then you can use the ChannelFactory

          ChannelFactory factory = new ChannelFactory()
          IService myService = factory.CreateChannel();
          myService.Foo();

          the drawback is you don't have any auto generated code so if you need asynchronous calls then you'll have to write that yourself. If you need the auto generated code, then I suppose you could use svcutil in the post build event of your service project. eg.

          svcutil "http://localhost:1892/IMyService.svc" /out:OutputDir\MyService.cs

          This however requires that you have an ISS running with a site that has your service's output directory as it's Content directory. Also you proporbly have some kind of source control so you might want to add some lines before the above line so that MyService.cs is checked out before svcutil overwrites it. That's the only two way I know of to avoiding having to update the service reference.

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          All this b/c the OP does not like the auto generated code. Not a chance, I have no problem using the auto code, I know what it does, I understand how it works and I have absolutely no interest in circumventing the MS methodology. The only time I can justify chucking this type of auto generated code is if the code is flaky or it needs to be extended for some reason, so far this has not been the case!

          Never underestimate the power of human stupidity RAH

          S 1 Reply Last reply
          0
          • M Mycroft Holmes

            All this b/c the OP does not like the auto generated code. Not a chance, I have no problem using the auto code, I know what it does, I understand how it works and I have absolutely no interest in circumventing the MS methodology. The only time I can justify chucking this type of auto generated code is if the code is flaky or it needs to be extended for some reason, so far this has not been the case!

            Never underestimate the power of human stupidity RAH

            S Offline
            S Offline
            Simon Bang Terkildsen
            wrote on last edited by
            #5

            Mycroft Holmes wrote:

            I have absolutely no interest in circumventing the MS methodology

            I don't see how either of those two methods is circumventing the MS methodology. When you press Update Service Reference it's svcutil that is being used. Using the ChannelFactory is what I personally use when I control both the server and the client. My primary reasons for this is; I don't have to update anything(Service reference) and I'm not limited to using DTO's. While converting a project from using the auto generated proxy to using the ChannelFactory may very well be a waste of time. I do still beleave my other suggestion (using the svcutil) is easy to do and would work.

            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