//------------------------------------------------------------------------------
// <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("LoansDBModel", "FK_Properties_Loans", "Loans", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(ClientExpressionInHierarchy.Models.Loan), "Properties", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(ClientExpressionInHierarchy.Models.Property), true)]

#endregion

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

        #endregion
        #region AddTo Methods
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Loans EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToLoans(Loan loan)
        {
            base.AddObject("Loans", loan);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Properties EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToProperties(Property property)
        {
            base.AddObject("Properties", property);
        }

        #endregion
    }
    

    #endregion
    
    #region Entities
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="LoansDBModel", Name="Loan")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Loan : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new Loan object.
        /// </summary>
        /// <param name="loanID">Initial value of the LoanID property.</param>
        /// <param name="name">Initial value of the Name property.</param>
        public static Loan CreateLoan(global::System.Int32 loanID, global::System.String name)
        {
            Loan loan = new Loan();
            loan.LoanID = loanID;
            loan.Name = name;
            return loan;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int32 LoanID
        {
            get
            {
                return _LoanID;
            }
            set
            {
                if (_LoanID != value)
                {
                    OnLoanIDChanging(value);
                    ReportPropertyChanging("LoanID");
                    _LoanID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("LoanID");
                    OnLoanIDChanged();
                }
            }
        }
        private global::System.Int32 _LoanID;
        partial void OnLoanIDChanging(global::System.Int32 value);
        partial void OnLoanIDChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [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
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("LoansDBModel", "FK_Properties_Loans", "Properties")]
        public EntityCollection<Property> Properties
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Property>("LoansDBModel.FK_Properties_Loans", "Properties");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Property>("LoansDBModel.FK_Properties_Loans", "Properties", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="LoansDBModel", Name="Property")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Property : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new Property object.
        /// </summary>
        /// <param name="propertyID">Initial value of the PropertyID property.</param>
        /// <param name="name">Initial value of the Name property.</param>
        /// <param name="type">Initial value of the Type property.</param>
        /// <param name="fullAddress">Initial value of the FullAddress property.</param>
        /// <param name="loanCount">Initial value of the LoanCount property.</param>
        /// <param name="loanID">Initial value of the LoanID property.</param>
        public static Property CreateProperty(global::System.Int32 propertyID, global::System.String name, global::System.String type, global::System.String fullAddress, global::System.Int32 loanCount, global::System.Int32 loanID)
        {
            Property property = new Property();
            property.PropertyID = propertyID;
            property.Name = name;
            property.Type = type;
            property.FullAddress = fullAddress;
            property.LoanCount = loanCount;
            property.LoanID = loanID;
            return property;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int32 PropertyID
        {
            get
            {
                return _PropertyID;
            }
            set
            {
                if (_PropertyID != value)
                {
                    OnPropertyIDChanging(value);
                    ReportPropertyChanging("PropertyID");
                    _PropertyID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("PropertyID");
                    OnPropertyIDChanged();
                }
            }
        }
        private global::System.Int32 _PropertyID;
        partial void OnPropertyIDChanging(global::System.Int32 value);
        partial void OnPropertyIDChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [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();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Type
        {
            get
            {
                return _Type;
            }
            set
            {
                OnTypeChanging(value);
                ReportPropertyChanging("Type");
                _Type = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Type");
                OnTypeChanged();
            }
        }
        private global::System.String _Type;
        partial void OnTypeChanging(global::System.String value);
        partial void OnTypeChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FullAddress
        {
            get
            {
                return _FullAddress;
            }
            set
            {
                OnFullAddressChanging(value);
                ReportPropertyChanging("FullAddress");
                _FullAddress = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FullAddress");
                OnFullAddressChanged();
            }
        }
        private global::System.String _FullAddress;
        partial void OnFullAddressChanging(global::System.String value);
        partial void OnFullAddressChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int32 LoanCount
        {
            get
            {
                return _LoanCount;
            }
            set
            {
                OnLoanCountChanging(value);
                ReportPropertyChanging("LoanCount");
                _LoanCount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("LoanCount");
                OnLoanCountChanged();
            }
        }
        private global::System.Int32 _LoanCount;
        partial void OnLoanCountChanging(global::System.Int32 value);
        partial void OnLoanCountChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int32 LoanID
        {
            get
            {
                return _LoanID;
            }
            set
            {
                OnLoanIDChanging(value);
                ReportPropertyChanging("LoanID");
                _LoanID = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("LoanID");
                OnLoanIDChanged();
            }
        }
        private global::System.Int32 _LoanID;
        partial void OnLoanIDChanging(global::System.Int32 value);
        partial void OnLoanIDChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("LoansDBModel", "FK_Properties_Loans", "Loans")]
        internal Loan Loan
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Loan>("LoansDBModel.FK_Properties_Loans", "Loans").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Loan>("LoansDBModel.FK_Properties_Loans", "Loans").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        internal EntityReference<Loan> LoanReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Loan>("LoansDBModel.FK_Properties_Loans", "Loans");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Loan>("LoansDBModel.FK_Properties_Loans", "Loans", value);
                }
            }
        }

        #endregion
    }

    #endregion
    
}
