//------------------------------------------------------------------------------ // // 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. /// Initial value of the AuditFields property. public static Product CreateProduct(global::System.Int32 id, global::System.String name, global::System.String description, global::System.Decimal price, AuditFields auditFields) { Product product = new Product(); product.Id = id; product.Name = name; product.Description = description; product.Price = price; product.AuditFields = StructuralObject.VerifyComplexObjectIsNotNull(auditFields, "AuditFields"); 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 Complex Properties /// /// No Metadata Documentation available. /// [EdmComplexPropertyAttribute()] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [XmlElement(IsNullable=true)] [SoapElement(IsNullable=true)] [DataMemberAttribute()] public AuditFields AuditFields { get { _AuditFields = GetValidValue(_AuditFields, "AuditFields", false, _AuditFieldsInitialized); _AuditFieldsInitialized = true; return _AuditFields; } set { OnAuditFieldsChanging(value); ReportPropertyChanging("AuditFields"); _AuditFields = SetValidValue(_AuditFields, value, "AuditFields"); _AuditFieldsInitialized = true; ReportPropertyChanged("AuditFields"); OnAuditFieldsChanged(); } } private AuditFields _AuditFields; private bool _AuditFieldsInitialized; partial void OnAuditFieldsChanging(AuditFields value); partial void OnAuditFieldsChanged(); #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 #region ComplexTypes /// /// No Metadata Documentation available. /// [EdmComplexTypeAttribute(NamespaceName="Model", Name="AuditFields")] [DataContractAttribute(IsReference=true)] [Serializable()] public partial class AuditFields : ComplexObject { #region Factory Method /// /// Create a new AuditFields object. /// /// Initial value of the CreateDate property. /// Initial value of the ModifiedDate property. public static AuditFields CreateAuditFields(global::System.DateTime createDate, global::System.DateTime modifiedDate) { AuditFields auditFields = new AuditFields(); auditFields.CreateDate = createDate; auditFields.ModifiedDate = modifiedDate; return auditFields; } #endregion #region Primitive Properties /// /// No Metadata Documentation available. /// [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.DateTime CreateDate { get { return _CreateDate; } set { OnCreateDateChanging(value); ReportPropertyChanging("CreateDate"); _CreateDate = StructuralObject.SetValidValue(value); ReportPropertyChanged("CreateDate"); OnCreateDateChanged(); } } private global::System.DateTime _CreateDate; partial void OnCreateDateChanging(global::System.DateTime value); partial void OnCreateDateChanged(); /// /// No Metadata Documentation available. /// [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.DateTime ModifiedDate { get { return _ModifiedDate; } set { OnModifiedDateChanging(value); ReportPropertyChanging("ModifiedDate"); _ModifiedDate = StructuralObject.SetValidValue(value); ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); /// /// No Metadata Documentation available. /// [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] [DataMemberAttribute()] public global::System.String CreatedBy { get { return _CreatedBy; } set { OnCreatedByChanging(value); ReportPropertyChanging("CreatedBy"); _CreatedBy = StructuralObject.SetValidValue(value, true); ReportPropertyChanged("CreatedBy"); OnCreatedByChanged(); } } private global::System.String _CreatedBy; partial void OnCreatedByChanging(global::System.String value); partial void OnCreatedByChanged(); #endregion } #endregion }