//------------------------------------------------------------------------------
// <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("MyWebSiteModel", "ArticlesCategories", "Categories", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(MyWebSite.Models.Category), "Articles", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(MyWebSite.Models.Article), true)]

#endregion

namespace MyWebSite.Models
{
    #region Contexts
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class MyWebSiteEntities : ObjectContext
    {
        #region Constructors
    
        /// <summary>
        /// Initializes a new MyWebSiteEntities object using the connection string found in the 'MyWebSiteEntities' section of the application configuration file.
        /// </summary>
        public MyWebSiteEntities() : base("name=MyWebSiteEntities", "MyWebSiteEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    
        /// <summary>
        /// Initialize a new MyWebSiteEntities object.
        /// </summary>
        public MyWebSiteEntities(string connectionString) : base(connectionString, "MyWebSiteEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    
        /// <summary>
        /// Initialize a new MyWebSiteEntities object.
        /// </summary>
        public MyWebSiteEntities(EntityConnection connection) : base(connection, "MyWebSiteEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    
        #endregion
    
        #region Partial Methods
    
        partial void OnContextCreated();
    
        #endregion
    
        #region ObjectSet Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Article> Articles
        {
            get
            {
                if ((_Articles == null))
                {
                    _Articles = base.CreateObjectSet<Article>("Articles");
                }
                return _Articles;
            }
        }
        private ObjectSet<Article> _Articles;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Category> Categories
        {
            get
            {
                if ((_Categories == null))
                {
                    _Categories = base.CreateObjectSet<Category>("Categories");
                }
                return _Categories;
            }
        }
        private ObjectSet<Category> _Categories;

        #endregion
        #region AddTo Methods
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Articles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToArticles(Article article)
        {
            base.AddObject("Articles", article);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCategories(Category category)
        {
            base.AddObject("Categories", category);
        }

        #endregion
    }
    

    #endregion
    
    #region Entities
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="MyWebSiteModel", Name="Article")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Article : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new Article object.
        /// </summary>
        /// <param name="articleId">Initial value of the ArticleId property.</param>
        /// <param name="category">Initial value of the Category property.</param>
        /// <param name="title">Initial value of the Title property.</param>
        /// <param name="published">Initial value of the Published property.</param>
        /// <param name="articleIntro">Initial value of the ArticleIntro property.</param>
        /// <param name="articleText">Initial value of the ArticleText property.</param>
        /// <param name="status">Initial value of the Status property.</param>
        /// <param name="imagePath">Initial value of the ImagePath property.</param>
        public static Article CreateArticle(global::System.Int32 articleId, global::System.Int32 category, global::System.String title, global::System.DateTime published, global::System.String articleIntro, global::System.String articleText, global::System.Byte status, global::System.String imagePath)
        {
            Article article = new Article();
            article.ArticleId = articleId;
            article.Category = category;
            article.Title = title;
            article.Published = published;
            article.ArticleIntro = articleIntro;
            article.ArticleText = articleText;
            article.Status = status;
            article.ImagePath = imagePath;
            return article;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int32 ArticleId
        {
            get
            {
                return _ArticleId;
            }
            set
            {
                if (_ArticleId != value)
                {
                    OnArticleIdChanging(value);
                    ReportPropertyChanging("ArticleId");
                    _ArticleId = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ArticleId");
                    OnArticleIdChanged();
                }
            }
        }
        private global::System.Int32 _ArticleId;
        partial void OnArticleIdChanging(global::System.Int32 value);
        partial void OnArticleIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int32 Category
        {
            get
            {
                return _Category;
            }
            set
            {
                OnCategoryChanging(value);
                ReportPropertyChanging("Category");
                _Category = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Category");
                OnCategoryChanged();
            }
        }
        private global::System.Int32 _Category;
        partial void OnCategoryChanging(global::System.Int32 value);
        partial void OnCategoryChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime Published
        {
            get
            {
                return _Published;
            }
            set
            {
                OnPublishedChanging(value);
                ReportPropertyChanging("Published");
                _Published = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Published");
                OnPublishedChanged();
            }
        }
        private global::System.DateTime _Published;
        partial void OnPublishedChanging(global::System.DateTime value);
        partial void OnPublishedChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ArticleIntro
        {
            get
            {
                return _ArticleIntro;
            }
            set
            {
                OnArticleIntroChanging(value);
                ReportPropertyChanging("ArticleIntro");
                _ArticleIntro = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ArticleIntro");
                OnArticleIntroChanged();
            }
        }
        private global::System.String _ArticleIntro;
        partial void OnArticleIntroChanging(global::System.String value);
        partial void OnArticleIntroChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ArticleText
        {
            get
            {
                return _ArticleText;
            }
            set
            {
                OnArticleTextChanging(value);
                ReportPropertyChanging("ArticleText");
                _ArticleText = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ArticleText");
                OnArticleTextChanged();
            }
        }
        private global::System.String _ArticleText;
        partial void OnArticleTextChanging(global::System.String value);
        partial void OnArticleTextChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Byte Status
        {
            get
            {
                return _Status;
            }
            set
            {
                OnStatusChanging(value);
                ReportPropertyChanging("Status");
                _Status = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Status");
                OnStatusChanged();
            }
        }
        private global::System.Byte _Status;
        partial void OnStatusChanging(global::System.Byte value);
        partial void OnStatusChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ImagePath
        {
            get
            {
                return _ImagePath;
            }
            set
            {
                OnImagePathChanging(value);
                ReportPropertyChanging("ImagePath");
                _ImagePath = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ImagePath");
                OnImagePathChanged();
            }
        }
        private global::System.String _ImagePath;
        partial void OnImagePathChanging(global::System.String value);
        partial void OnImagePathChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("MyWebSiteModel", "ArticlesCategories", "Categories")]
        public Category Category1
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Category>("MyWebSiteModel.ArticlesCategories", "Categories").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Category>("MyWebSiteModel.ArticlesCategories", "Categories").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Category> Category1Reference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Category>("MyWebSiteModel.ArticlesCategories", "Categories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Category>("MyWebSiteModel.ArticlesCategories", "Categories", value);
                }
            }
        }

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

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int32 CategoryId
        {
            get
            {
                return _CategoryId;
            }
            set
            {
                if (_CategoryId != value)
                {
                    OnCategoryIdChanging(value);
                    ReportPropertyChanging("CategoryId");
                    _CategoryId = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("CategoryId");
                    OnCategoryIdChanged();
                }
            }
        }
        private global::System.Int32 _CategoryId;
        partial void OnCategoryIdChanging(global::System.Int32 value);
        partial void OnCategoryIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String CategoryName
        {
            get
            {
                return _CategoryName;
            }
            set
            {
                OnCategoryNameChanging(value);
                ReportPropertyChanging("CategoryName");
                _CategoryName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("CategoryName");
                OnCategoryNameChanged();
            }
        }
        private global::System.String _CategoryName;
        partial void OnCategoryNameChanging(global::System.String value);
        partial void OnCategoryNameChanged();

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

        #endregion
    }

    #endregion
    
}
