

using System;
using System.Collections.Generic;

namespace _3_ReverseMap 
{
    // Generated by Telerik OpenAccess
    // Used template: e:\program files\telerik\openaccess orm\sdk\IDEIntegrations\templates\PCClassGeneration\cs\templates\classgen\class\partialdesignerdefault.vm
    [Telerik.OpenAccess.Persistent(Identity=typeof(_3_ReverseMap.OrderDetail.ID))]
    public partial class OrderDetail 
    {
        private int orderID; // pk 

        private int productID; // pk 

        private float discount;

        private short quantity;

        private Decimal unitPrice;

        private Order order; // inverse Order.orderDetail

        private Product product;


        #region Object ID class
        // Application identity objectid-class.
        // Used template: e:\program files\telerik\openaccess orm\sdk\IDEIntegrations\templates\PCClassGeneration\cs\templates\classgen\objectid\default.vm
        public class ID : Telerik.OpenAccess.IObjectId 
        {
            public int orderID; //pk

            public int productID; //pk


            public ID() 
            {
            }

            public ID(string s) 
            {
                int i, p = 0;
                i = s.IndexOf('-', p);
                orderID = System.Int32.Parse(s.Substring(p, i-p));
                p = i + 1;
                i = s.IndexOf('-', p);
                productID = System.Int32.Parse(s.Substring(p));

            }

            public override bool Equals(object o) 
            {
                if (this == o) return true;
                if (!(o is OrderDetail.ID)) return false;

                OrderDetail.ID id = (OrderDetail.ID) o;

                if(this.orderID != id.orderID) return false;

                if(this.productID != id.productID) return false;

                return true;
            }

            public override int GetHashCode() 
            {
                int result = 0;
                result = 29 * result + orderID.GetHashCode();
                result = 29 * result + productID.GetHashCode();

                return result;
            }

            public override string ToString() 
            {
                System.Text.StringBuilder buffer = new System.Text.StringBuilder();

                buffer.Append(orderID).Append('-');

                buffer.Append(productID);

                return buffer.ToString();
            }
        }

        #endregion //Object ID class
    }
}

#region main class file contents
/*


using System;
using System.Collections.Generic;

namespace _3_ReverseMap 
{
    //Generated by Telerik OpenAccess
    public partial class OrderDetail 
    {
        //The 'no-args' constructor required by OpenAccess. 
        public OrderDetail() 
        {
        }
    
        [Telerik.OpenAccess.FieldAlias("orderID")]
        public int OrderID
        {
            get { return orderID; }
            set { this.orderID = value; }
        }
 
        [Telerik.OpenAccess.FieldAlias("productID")]
        public int ProductID
        {
            get { return productID; }
            set { this.productID = value; }
        }
 
        [Telerik.OpenAccess.FieldAlias("discount")]
        public float Discount
        {
            get { return discount; }
            set { this.discount = value; }
        }
 
        [Telerik.OpenAccess.FieldAlias("quantity")]
        public short Quantity
        {
            get { return quantity; }
            set { this.quantity = value; }
        }
 
        [Telerik.OpenAccess.FieldAlias("unitPrice")]
        public Decimal UnitPrice
        {
            get { return unitPrice; }
            set { this.unitPrice = value; }
        }
 
        [Telerik.OpenAccess.FieldAlias("order")]
        public Order Order
        {
            get { return order; }
            set { this.order = value; }
        }
 
        [Telerik.OpenAccess.FieldAlias("product")]
        public Product Product
        {
            get { return product; }
            set { this.product = value; }
        }
 

    }
}
*/
#endregion //main class file contents
