how to use windows azure market

4057 ワード

here is the sample.
namespace USCrime2006and2007

{

    class Program

    {

        static void Main(string[] args)

        {

            GetData aa = new GetData();

            aa.GetFertilityData();

        }





    }



    class GetData

    {

        public GetData()

        {

            context = new UnitedNationsGenderInfo2007Container(new Uri("https://api.datamarket.azure.com/UnitedNations/GenderInfo2007/v1/"));



         // context = new UnitedNationsGenderInfo2007Container(new Uri("https://api.datamarket.azure.com/UnitedNations/GenderInfo2007/v1/Values?$filter=DataSeriesId%20eq%20%2713%27&$skip=500"));

            context.IgnoreMissingProperties = true;

            context.Credentials = new NetworkCredential("[email protected]", "SBrjzkexSLcghuUyE3m+MsvwMSbBkobP2Wt58Lf5rxU");



        }

        private UnitedNationsGenderInfo2007Container context;



             //    public method that returns a list of fertility data

        public IList<Values> GetFertilityData()

        {

            IEnumerable<Values> query = context.Values.Where(fertility => fertility.DataSeriesId == "13").OrderBy(fertility => fertility.CountryName);

           // IEnumerable<Values> query = context.Values.;

            try

            {

                return query.ToList<Values>();

            }

            catch (Exception ex)

            {

                Console.WriteLine("Error: {0}", ex.Message);

                return null;

            }  // end try

        }  // end function 

    }

}