خرید بک لینک

Vote count: 0

I'm new to protobuf and fairly new to asp .net. so I might need help on this. I have this code snippet for my PersonsController:

public class PersonController : ApiController
{
    [ProtoContract]
    public class Person
    {
        [ProtoMember(1)]
        public int ID { get; set; }
        [ProtoMember(2)]
        public string First { get; set; }
        [ProtoMember(3)]
        public string Last { get; set; }
    }
    // GET api/values
    public IEnumerable<Person> Get()
    {
        List<Person> myList = new List<Person> { 
            new Person { ID = 0, First = "Judy", Last  = "Lee" },
            new Person { ID = 1, First = "John", Last  = "Doe" },
            new Person { ID = 2, First = "George", Last  = "Poole" },
        };

        retu myList;
    }
}

and I'm wondering if that's enough to be able to send out the protobuf data and be consumed by other applications?

I'm trying to access it directly in google chrome and all I'm getting is an XML format of the data.

<ArrayOfPersonController.Person xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/SampleSerialize.Controllers">
  <PersonController.Person>
    <First>Judy</First>
    <ID>0</ID>
    <Last>Lee</Last>
  </PersonController.Person>
  <PersonController.Person>
    <First>John</First>
    <ID>1</ID>
    <Last>Doe</Last>
  </PersonController.Person>
  <PersonController.Person>
    <First>George</First>
    <ID>2</ID>
    <Last>Poole</Last>
  </PersonController.Person>
</ArrayOfPersonController.Person>

How do I know if I'm able to send out the serialized data?

asked 3 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 23 بهمن 1394 ساعت: 2:04

صفحه بندی