//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.Data.EntityClient;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Runtime.Serialization;

[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata

[assembly: EdmRelationshipAttribute("WijMarketModel", "FK_Stock_Sector", "Sector", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(WijMarket.Models.Sector), "Stock", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(WijMarket.Models.StockClass), true)]
[assembly: EdmRelationshipAttribute("WijMarketModel", "FK_Stock_StockExchange", "StockExchange", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(WijMarket.Models.StockExchange), "Stock", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(WijMarket.Models.StockClass), true)]

#endregion

namespace WijMarket.Models
{
    #region Contexts
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class WijMarketEntities : ObjectContext
    {
        #region Constructors
    
        /// <summary>
        /// Initializes a new WijMarketEntities object using the connection string found in the 'WijMarketEntities' section of the application configuration file.
        /// </summary>
        public WijMarketEntities() : base("name=WijMarketEntities", "WijMarketEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    
        /// <summary>
        /// Initialize a new WijMarketEntities object.
        /// </summary>
        public WijMarketEntities(string connectionString) : base(connectionString, "WijMarketEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    
        /// <summary>
        /// Initialize a new WijMarketEntities object.
        /// </summary>
        public WijMarketEntities(EntityConnection connection) : base(connection, "WijMarketEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    
        #endregion
    
        #region Partial Methods
    
        partial void OnContextCreated();
    
        #endregion
    
        #region ObjectSet Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Sector> Sector
        {
            get
            {
                if ((_Sector == null))
                {
                    _Sector = base.CreateObjectSet<Sector>("Sector");
                }
                return _Sector;
            }
        }
        private ObjectSet<Sector> _Sector;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<StockClass> Stock
        {
            get
            {
                if ((_Stock == null))
                {
                    _Stock = base.CreateObjectSet<StockClass>("Stock");
                }
                return _Stock;
            }
        }
        private ObjectSet<StockClass> _Stock;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<StockExchange> StockExchange
        {
            get
            {
                if ((_StockExchange == null))
                {
                    _StockExchange = base.CreateObjectSet<StockExchange>("StockExchange");
                }
                return _StockExchange;
            }
        }
        private ObjectSet<StockExchange> _StockExchange;

        #endregion
        #region AddTo Methods
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Sector EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToSector(Sector sector)
        {
            base.AddObject("Sector", sector);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Stock EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToStock(StockClass stockClass)
        {
            base.AddObject("Stock", stockClass);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the StockExchange EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToStockExchange(StockExchange stockExchange)
        {
            base.AddObject("StockExchange", stockExchange);
        }

        #endregion
    }
    

    #endregion
    
    #region Entities
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="WijMarketModel", Name="Sector")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Sector : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new Sector object.
        /// </summary>
        /// <param name="sectorId">Initial value of the SectorId property.</param>
        /// <param name="sectorName">Initial value of the SectorName property.</param>
        public static Sector CreateSector(global::System.Int32 sectorId, global::System.String sectorName)
        {
            Sector sector = new Sector();
            sector.SectorId = sectorId;
            sector.SectorName = sectorName;
            return sector;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int32 SectorId
        {
            get
            {
                return _SectorId;
            }
            set
            {
                if (_SectorId != value)
                {
                    OnSectorIdChanging(value);
                    ReportPropertyChanging("SectorId");
                    _SectorId = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("SectorId");
                    OnSectorIdChanged();
                }
            }
        }
        private global::System.Int32 _SectorId;
        partial void OnSectorIdChanging(global::System.Int32 value);
        partial void OnSectorIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String SectorName
        {
            get
            {
                return _SectorName;
            }
            set
            {
                OnSectorNameChanging(value);
                ReportPropertyChanging("SectorName");
                _SectorName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("SectorName");
                OnSectorNameChanged();
            }
        }
        private global::System.String _SectorName;
        partial void OnSectorNameChanging(global::System.String value);
        partial void OnSectorNameChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("WijMarketModel", "FK_Stock_Sector", "Stock")]
        public EntityCollection<StockClass> Stock
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<StockClass>("WijMarketModel.FK_Stock_Sector", "Stock");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<StockClass>("WijMarketModel.FK_Stock_Sector", "Stock", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="WijMarketModel", Name="StockClass")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class StockClass : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new StockClass object.
        /// </summary>
        /// <param name="stockId">Initial value of the StockId property.</param>
        /// <param name="stockCode">Initial value of the StockCode property.</param>
        /// <param name="exchangeId">Initial value of the ExchangeId property.</param>
        /// <param name="stockName">Initial value of the StockName property.</param>
        public static StockClass CreateStockClass(global::System.Int32 stockId, global::System.String stockCode, global::System.Int32 exchangeId, global::System.String stockName)
        {
            StockClass stockClass = new StockClass();
            stockClass.StockId = stockId;
            stockClass.StockCode = stockCode;
            stockClass.ExchangeId = exchangeId;
            stockClass.StockName = stockName;
            return stockClass;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int32 StockId
        {
            get
            {
                return _StockId;
            }
            set
            {
                if (_StockId != value)
                {
                    OnStockIdChanging(value);
                    ReportPropertyChanging("StockId");
                    _StockId = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("StockId");
                    OnStockIdChanged();
                }
            }
        }
        private global::System.Int32 _StockId;
        partial void OnStockIdChanging(global::System.Int32 value);
        partial void OnStockIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int32> SectorId
        {
            get
            {
                return _SectorId;
            }
            set
            {
                OnSectorIdChanging(value);
                ReportPropertyChanging("SectorId");
                _SectorId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("SectorId");
                OnSectorIdChanged();
            }
        }
        private Nullable<global::System.Int32> _SectorId;
        partial void OnSectorIdChanging(Nullable<global::System.Int32> value);
        partial void OnSectorIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String StockCode
        {
            get
            {
                return _StockCode;
            }
            set
            {
                OnStockCodeChanging(value);
                ReportPropertyChanging("StockCode");
                _StockCode = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("StockCode");
                OnStockCodeChanged();
            }
        }
        private global::System.String _StockCode;
        partial void OnStockCodeChanging(global::System.String value);
        partial void OnStockCodeChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int32 ExchangeId
        {
            get
            {
                return _ExchangeId;
            }
            set
            {
                OnExchangeIdChanging(value);
                ReportPropertyChanging("ExchangeId");
                _ExchangeId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ExchangeId");
                OnExchangeIdChanged();
            }
        }
        private global::System.Int32 _ExchangeId;
        partial void OnExchangeIdChanging(global::System.Int32 value);
        partial void OnExchangeIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String StockName
        {
            get
            {
                return _StockName;
            }
            set
            {
                OnStockNameChanging(value);
                ReportPropertyChanging("StockName");
                _StockName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("StockName");
                OnStockNameChanged();
            }
        }
        private global::System.String _StockName;
        partial void OnStockNameChanging(global::System.String value);
        partial void OnStockNameChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("WijMarketModel", "FK_Stock_Sector", "Sector")]
        public Sector Sector
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Sector>("WijMarketModel.FK_Stock_Sector", "Sector").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Sector>("WijMarketModel.FK_Stock_Sector", "Sector").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Sector> SectorReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Sector>("WijMarketModel.FK_Stock_Sector", "Sector");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Sector>("WijMarketModel.FK_Stock_Sector", "Sector", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("WijMarketModel", "FK_Stock_StockExchange", "StockExchange")]
        public StockExchange StockExchange
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<StockExchange>("WijMarketModel.FK_Stock_StockExchange", "StockExchange").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<StockExchange>("WijMarketModel.FK_Stock_StockExchange", "StockExchange").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<StockExchange> StockExchangeReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<StockExchange>("WijMarketModel.FK_Stock_StockExchange", "StockExchange");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<StockExchange>("WijMarketModel.FK_Stock_StockExchange", "StockExchange", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="WijMarketModel", Name="StockExchange")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class StockExchange : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new StockExchange object.
        /// </summary>
        /// <param name="exchangeId">Initial value of the ExchangeId property.</param>
        public static StockExchange CreateStockExchange(global::System.Int32 exchangeId)
        {
            StockExchange stockExchange = new StockExchange();
            stockExchange.ExchangeId = exchangeId;
            return stockExchange;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int32 ExchangeId
        {
            get
            {
                return _ExchangeId;
            }
            set
            {
                if (_ExchangeId != value)
                {
                    OnExchangeIdChanging(value);
                    ReportPropertyChanging("ExchangeId");
                    _ExchangeId = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ExchangeId");
                    OnExchangeIdChanged();
                }
            }
        }
        private global::System.Int32 _ExchangeId;
        partial void OnExchangeIdChanging(global::System.Int32 value);
        partial void OnExchangeIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ExchangeName
        {
            get
            {
                return _ExchangeName;
            }
            set
            {
                OnExchangeNameChanging(value);
                ReportPropertyChanging("ExchangeName");
                _ExchangeName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ExchangeName");
                OnExchangeNameChanged();
            }
        }
        private global::System.String _ExchangeName;
        partial void OnExchangeNameChanging(global::System.String value);
        partial void OnExchangeNameChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("WijMarketModel", "FK_Stock_StockExchange", "Stock")]
        public EntityCollection<StockClass> Stock
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<StockClass>("WijMarketModel.FK_Stock_StockExchange", "Stock");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<StockClass>("WijMarketModel.FK_Stock_StockExchange", "Stock", value);
                }
            }
        }

        #endregion
    }

    #endregion
    
}
