locked
WFC Custom data classes aren't working RRS feed

  • Question

  • Hello. I'v run into a frustrating problem and I can't figure out what I'm doing wrong.

    I'v created a Silverlight 5 application in a MVC 4 web application, and created at WFC service to connect the Silverlight app to the database. This was working quite well untill i attempted to add a custom data class. I have created two assemblies, one for the MVC and one for silverlight that uses codelinking to share the classes.

    The custom class I'm working with now is this:

    [DataContract(Name = "MediaeList", Namespace = "DataClasses")]
        public class MediaeList
        {
            [DataMember]
            public string Mediae { get; set; }
        }

    And the service class is this:

    [ServiceContract(Name = "IMediaService", Namespace = "BlackBird")]
        public interface IMediaService
        {
            [OperationContract]
            MediaeList GetMediaList();
    
            [OperationContract]
            DateTime GetServerTime();
        }
    
        
        [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
        public class MediaService : IMediaService
        {
            public MediaeList GetMediaList()
            {
                var mediaList = new MediaeList() { Mediae = "Hei" };
                return mediaList;
            }
      
            public DateTime GetServerTime()
            {
                return DateTime.Now;
            }
    
        }

    I'f I comment out the parts conserning the custom data class it works fine and the silverlight app is able to add the reference.

    If I include the parts with the custom data class silverlight is able to add the reference, but in the program file of the silverlight app I'm unable to find the classpath for the MediaService.

    using Blackbird.MediaPlayer.MediaService;

    All the clientConfig settings are identical with and without custom classes.

    Anyone got any ideas?


    • Edited by Mikael Gyth Tuesday, February 19, 2013 7:22 AM
    Monday, February 18, 2013 7:06 PM

Answers

  • Hello, and thanks for responding.

    Yes I did update the reference.

    I'd reply sooner, but this site was unavailable for a while.

    It turns out that the solutions was as simple as turning off the "Reuse types in referenced assemblies" in the reference config, as described in this post:  Custom tool warning: cannot import wsdl:portType

    • Marked as answer by Mikael Gyth Tuesday, February 19, 2013 1:21 PM
    Tuesday, February 19, 2013 1:21 PM

All replies

  • I'm not sure if this is it or not, but did you Update the service reference?  If you make a change to the service, you have to regenerate the service reference to include the new changes in the interface.
    Tuesday, February 19, 2013 12:48 PM
  • Hello, and thanks for responding.

    Yes I did update the reference.

    I'd reply sooner, but this site was unavailable for a while.

    It turns out that the solutions was as simple as turning off the "Reuse types in referenced assemblies" in the reference config, as described in this post:  Custom tool warning: cannot import wsdl:portType

    • Marked as answer by Mikael Gyth Tuesday, February 19, 2013 1:21 PM
    Tuesday, February 19, 2013 1:21 PM