Alternative to Using an Entity as a Parameter to an Invoke Method in WCF RIA Services

后端 未结 2 513
旧时难觅i
旧时难觅i 2021-01-12 11:48

Howdy, ya\'ll! First question on StackOverflow! :-)

So here\'s the scenario: We\'re working on a web app with Silverlight 4 and using WCF RIA Services 1.0 SP1 Beta f

2条回答
  •  醉梦人生
    2021-01-12 12:26

    I have the following and it works for me.

    namespace BusinessApplication2.Web
    {
        using System.ComponentModel.DataAnnotations;
        using System.Linq;
        using System.ServiceModel.DomainServices.Hosting;
        using System.ServiceModel.DomainServices.Server;
    
        [EnableClientAccess()]
        public class DomainService1 : DomainService
        {
            public IQueryable GetEntityOnes()
            {
                return null;
            }
    
            public IQueryable GetEntityTwos()
            {
                return null;
            }
    
            [Invoke]
            public SerializableResult GetSerializableResult(EntityOne one, EntityTwo two)
            {
                return new SerializableResult() { Result = "It woooooorrrked!" };
            }
        }
    
        public class EntityOne
        {
            [Key]
            public int Id { get; set; }
        }
    
        public class EntityTwo
        {
            [Key]
            public int Id { get; set; }
        }
    
        public class SerializableResult
        {
            public string Result { get; set; }
        }
    }
    

提交回复
热议问题