Exemplo n.º 1
0
        private static void HandleProjection(MasterDataContext context)
        {
            var projections = from patient in context.Patients
                              select new {Id = patient.Id, FullName = patient.LastName + ", " + patient.FirstName};

            foreach (var projection in projections)
            {
                Console.WriteLine("{0}-{1}", projection.Id, projection.FullName);
            }
        }
Exemplo n.º 2
0
        public void Execute()
        {
            var uri = new Uri("http://localhost:63458/MasterDataService.svc");
            var context = new MasterDataContext(uri);

            HandleInlineCount(context);
            HandleProjection(context);
            //HandleWebApiClient(uri);

            Console.ReadLine();
        }
Exemplo n.º 3
0
        private static void HandleInlineCount(MasterDataContext context)
        {
            var patients = (from patient in context.Patients.IncludeTotalCount()
                            where patient.Id > 2
                            select patient) as DataServiceQuery<Patient>;

            var result = patients.Execute() as QueryOperationResponse<Patient>;
            Console.WriteLine("There were {0} total patients.", result.TotalCount);

            foreach (var patient in result)
            {
                Console.WriteLine("{0}, {1}", patient.LastName, patient.FirstName);
            }

            Console.WriteLine();
        }