//------------------------------------------------------------------------------ // // 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. // //------------------------------------------------------------------------------ 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("Model", "CategoryProduct", "Category", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(Model.Category), "Product", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(Model.Product))] #endregion namespace Model { #region Contexts /// /// No Metadata Documentation available. /// public partial class ModelContainer : ObjectContext { #region Constructors /// /// Initializes a new ModelContainer object using the connection string found in the 'ModelContainer' section of the application configuration file. /// public ModelContainer() : base("name=ModelContainer", "ModelContainer") { this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } /// /// Initialize a new ModelContainer object. /// public ModelContainer(string connectionString) : base(connectionString, "ModelContainer") { this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } /// /// Initialize a new ModelContainer object. /// public ModelContainer(EntityConnection connection) : base(connection, "ModelContainer") { this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } #endregion #region Partial Methods partial void OnContextCreated(); #endregion #region ObjectSet Properties /// /// No Metadata Documentation available. /// public ObjectSet Products { get { if ((_Products == null)) { _Products = base.CreateObjectSet("Products"); } return _Products; } } private ObjectSet _Products; /// /// No Metadata Documentation available. /// public ObjectSet Categories { get { if ((_Categories == null)) { _Categories = base.CreateObjectSet("Categories"); } return _Categories; } } private ObjectSet _Categories; #endregion #region AddTo Methods /// /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// public void AddToProducts(Product product) { base.AddObject("Products", product); } /// /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// public void AddToCategories(Category category) { base.AddObject("Categories", category); } #endregion } #endregion #region Entities /// /// No Metadata Documentation available. /// [EdmEntityTypeAttribute(NamespaceName="Model", Name="Category")] [Serializable()] [DataContractAttribute(IsReference=true)] public partial class Category : EntityObject { #region Factory Method /// /// Create a new Category object. /// /// Initial value of the Id property. /// Initial value of the Name property. public static Category CreateCategory(global::System.Int32 id, global::System.String name) { Category category = new Category(); category.Id = id; category.Name = name; return category; } #endregion #region Primitive Properties /// /// No Metadata Documentation available. /// [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] [DataMemberAttribute()] public global::System.Int32 Id { get { return _Id; } set { if (_Id != value) { OnIdChanging(value); ReportPropertyChanging("Id"); _Id = StructuralObject.SetValidValue(value); ReportPropertyChanged("Id"); OnIdChanged(); } } } private global::System.Int32 _Id; partial void OnIdChanging(global::System.Int32 value); partial void OnIdChanged(); /// /// No Metadata Documentation available. /// [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.String Name { get { return _Name; } set { OnNameChanging(value); ReportPropertyChanging("Name"); _Name = StructuralObject.SetValidValue(value, false); ReportPropertyChanged("Name"); OnNameChanged(); } } private global::System.String _Name; partial void OnNameChanging(global::System.String value); partial void OnNameChanged(); #endregion #region Navigation Properties /// /// No Metadata Documentation available. /// [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] [EdmRelationshipNavigationPropertyAttribute("Model", "CategoryProduct", "Product")] public EntityCollection Products { get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection("Model.CategoryProduct", "Product"); } set { if ((value != null)) { ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection("Model.CategoryProduct", "Product", value); } } } #endregion } /// /// No Metadata Documentation available. /// [EdmEntityTypeAttribute(NamespaceName="Model", Name="Product")] [Serializable()] [DataContractAttribute(IsReference=true)] public partial class Product : EntityObject { #region Factory Method /// /// Create a new Product object. /// /// Initial value of the Id property. /// Initial value of the Name property. /// Initial value of the Description property. /// Initial value of the Price property. public static Product CreateProduct(global::System.Int32 id, global::System.String name, global::System.String description, global::System.Decimal price) { Product product = new Product(); product.Id = id; product.Name = name; product.Description = description; product.Price = price; return product; } #endregion #region Primitive Properties /// /// No Metadata Documentation available. /// [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] [DataMemberAttribute()] public global::System.Int32 Id { get { return _Id; } set { if (_Id != value) { OnIdChanging(value); ReportPropertyChanging("Id"); _Id = StructuralObject.SetValidValue(value); ReportPropertyChanged("Id"); OnIdChanged(); } } } private global::System.Int32 _Id; partial void OnIdChanging(global::System.Int32 value); partial void OnIdChanged(); /// /// No Metadata Documentation available. /// [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.String Name { get { return _Name; } set { OnNameChanging(value); ReportPropertyChanging("Name"); _Name = StructuralObject.SetValidValue(value, false); ReportPropertyChanged("Name"); OnNameChanged(); } } private global::System.String _Name; partial void OnNameChanging(global::System.String value); partial void OnNameChanged(); /// /// No Metadata Documentation available. /// [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.String Description { get { return _Description; } set { OnDescriptionChanging(value); ReportPropertyChanging("Description"); _Description = StructuralObject.SetValidValue(value, false); ReportPropertyChanged("Description"); OnDescriptionChanged(); } } private global::System.String _Description; partial void OnDescriptionChanging(global::System.String value); partial void OnDescriptionChanged(); /// /// No Metadata Documentation available. /// [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.Decimal Price { get { return _Price; } set { OnPriceChanging(value); ReportPropertyChanging("Price"); _Price = StructuralObject.SetValidValue(value); ReportPropertyChanged("Price"); OnPriceChanged(); } } private global::System.Decimal _Price; partial void OnPriceChanging(global::System.Decimal value); partial void OnPriceChanged(); #endregion #region Navigation Properties /// /// No Metadata Documentation available. /// [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] [EdmRelationshipNavigationPropertyAttribute("Model", "CategoryProduct", "Category")] public Category Category { get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("Model.CategoryProduct", "Category").Value; } set { ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("Model.CategoryProduct", "Category").Value = value; } } /// /// No Metadata Documentation available. /// [BrowsableAttribute(false)] [DataMemberAttribute()] public EntityReference CategoryReference { get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("Model.CategoryProduct", "Category"); } set { if ((value != null)) { ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference("Model.CategoryProduct", "Category", value); } } } #endregion } #endregion }