Click here to Skip to main content
15,896,153 members
Articles / Web Development / ASP.NET

CRUD operations in Siverlight using ADO.NET Data Service

Rate me:
Please Sign up or sign in to vote.
4.77/5 (12 votes)
10 Feb 2008CPOL8 min read 118.3K   784   76  
The simplest way to do CRUD (Create, Retrieve, Update, Delete) operations in Silverlight using ADO.NET Data Service (Astoria).
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.1433
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

// Original file name: Products.cs
// Generation date: 2/10/2008 2:38:50 AM
namespace MyStoreModel
{
    
    /// <summary>
    /// There are no comments for MyStoreEntities in the schema.
    /// </summary>
    public partial class MyStoreEntities : global::Microsoft.Data.WebClient.WebDataContext
    {
        
        /// <summary>
        /// Initialize a new MyStoreEntities object.
        /// </summary>
        public MyStoreEntities(string uriString) : 
                base(uriString)
        {
        }
        /// <summary>
        /// Initialize a new MyStoreEntities object.
        /// </summary>
        public MyStoreEntities(global::System.Uri baseUri) : 
                base(baseUri)
        {
        }
        /// <summary>
        /// There are no comments for Products in the schema.
        /// </summary>
        public global::Microsoft.Data.WebClient.WebDataQuery<Products> Products
        {
            get
            {
                if ((this._Products == null))
                {
                    this._Products = base.CreateQuery<Products>("Products");
                }
                return this._Products;
            }
        }
        private global::Microsoft.Data.WebClient.WebDataQuery<Products> _Products;
    }
    /// <summary>
    /// There are no comments for MyStoreModel.Products in the schema.
    /// </summary>
    /// <KeyProperties>
    /// ProductID
    /// </KeyProperties>
    //[global::System.Serializable()]
    public partial class Products
    {
        /// <summary>
        /// Create a new Products object.
        /// </summary>
        /// <param name="productID">Initial value of ProductID.</param>
        public static Products CreateProducts(int productID)
        {
            Products products = new Products();
            products.ProductID = productID;
            return products;
        }
        /// <summary>
        /// There are no comments for Property ProductID in the schema.
        /// </summary>
        [global::Microsoft.Data.WebClient.KeyAttribute()]
        public int ProductID
        {
            get
            {
                return this._ProductID;
            }
            set
            {
                this.OnProductIDChanging(value);
                this._ProductID = value;
                this.OnProductIDChanged();
            }
        }
        private int _ProductID;
        partial void OnProductIDChanging(int value);
        partial void OnProductIDChanged();
        /// <summary>
        /// There are no comments for Property ProductName in the schema.
        /// </summary>
        public string ProductName
        {
            get
            {
                return this._ProductName;
            }
            set
            {
                this.OnProductNameChanging(value);
                this._ProductName = value;
                this.OnProductNameChanged();
            }
        }
        private string _ProductName;
        partial void OnProductNameChanging(string value);
        partial void OnProductNameChanged();
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Singapore Singapore
Michael Sync is a Microsoft MVP for Silverlight and a member of Microsoft WPF/Silverlight Insider Team.

Please find more details about me in my blog.

Comments and Discussions