//------------------------------------------------------------------------------
// <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("MvcDemo.Dal.EntityModels", "FK_Files_Documents", "Documents", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(MvcDemo.Dal.EntityModels.Document), "DocFiles", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(MvcDemo.Dal.EntityModels.DocFile), true)]
[assembly: EdmRelationshipAttribute("MvcDemo.Dal.EntityModels", "FK_FileVersions_Files", "DocFiles", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(MvcDemo.Dal.EntityModels.DocFile), "FileVersions", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(MvcDemo.Dal.EntityModels.FileVersion), true)]
[assembly: EdmRelationshipAttribute("MvcDemo.Dal.EntityModels", "FK_RelatedDocuments_Documents", "Documents", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(MvcDemo.Dal.EntityModels.Document), "RelatedDocuments", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(MvcDemo.Dal.EntityModels.RelatedDocument), true)]
[assembly: EdmRelationshipAttribute("MvcDemo.Dal.EntityModels", "FK_RelatedDocuments_Documents1", "Documents", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(MvcDemo.Dal.EntityModels.Document), "RelatedDocuments", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(MvcDemo.Dal.EntityModels.RelatedDocument), true)]

#endregion

namespace MvcDemo.Dal.EntityModels
{
    #region Contexts
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class DmsEntities : ObjectContext
    {
        #region Constructors
    
        /// <summary>
        /// Initializes a new DmsEntities object using the connection string found in the 'DmsEntities' section of the application configuration file.
        /// </summary>
        public DmsEntities() : base("name=DmsEntities", "DmsEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    
        /// <summary>
        /// Initialize a new DmsEntities object.
        /// </summary>
        public DmsEntities(string connectionString) : base(connectionString, "DmsEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    
        /// <summary>
        /// Initialize a new DmsEntities object.
        /// </summary>
        public DmsEntities(EntityConnection connection) : base(connection, "DmsEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    
        #endregion
    
        #region Partial Methods
    
        partial void OnContextCreated();
    
        #endregion
    
        #region ObjectSet Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<DocFile> DocFiles
        {
            get
            {
                if ((_DocFiles == null))
                {
                    _DocFiles = base.CreateObjectSet<DocFile>("DocFiles");
                }
                return _DocFiles;
            }
        }
        private ObjectSet<DocFile> _DocFiles;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Document> Documents
        {
            get
            {
                if ((_Documents == null))
                {
                    _Documents = base.CreateObjectSet<Document>("Documents");
                }
                return _Documents;
            }
        }
        private ObjectSet<Document> _Documents;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<FileVersion> FileVersions
        {
            get
            {
                if ((_FileVersions == null))
                {
                    _FileVersions = base.CreateObjectSet<FileVersion>("FileVersions");
                }
                return _FileVersions;
            }
        }
        private ObjectSet<FileVersion> _FileVersions;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<RelatedDocument> RelatedDocuments
        {
            get
            {
                if ((_RelatedDocuments == null))
                {
                    _RelatedDocuments = base.CreateObjectSet<RelatedDocument>("RelatedDocuments");
                }
                return _RelatedDocuments;
            }
        }
        private ObjectSet<RelatedDocument> _RelatedDocuments;

        #endregion
        #region AddTo Methods
    
        /// <summary>
        /// Deprecated Method for adding a new object to the DocFiles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToDocFiles(DocFile docFile)
        {
            base.AddObject("DocFiles", docFile);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Documents EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToDocuments(Document document)
        {
            base.AddObject("Documents", document);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the FileVersions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToFileVersions(FileVersion fileVersion)
        {
            base.AddObject("FileVersions", fileVersion);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the RelatedDocuments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToRelatedDocuments(RelatedDocument relatedDocument)
        {
            base.AddObject("RelatedDocuments", relatedDocument);
        }

        #endregion
    }
    

    #endregion
    
    #region Entities
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="MvcDemo.Dal.EntityModels", Name="DocFile")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class DocFile : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new DocFile object.
        /// </summary>
        /// <param name="fileId">Initial value of the FileId property.</param>
        /// <param name="documentId">Initial value of the DocumentId property.</param>
        /// <param name="sequence">Initial value of the Sequence property.</param>
        public static DocFile CreateDocFile(global::System.Int64 fileId, global::System.Int64 documentId, global::System.Int32 sequence)
        {
            DocFile docFile = new DocFile();
            docFile.FileId = fileId;
            docFile.DocumentId = documentId;
            docFile.Sequence = sequence;
            return docFile;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 FileId
        {
            get
            {
                return _FileId;
            }
            set
            {
                if (_FileId != value)
                {
                    OnFileIdChanging(value);
                    ReportPropertyChanging("FileId");
                    _FileId = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("FileId");
                    OnFileIdChanged();
                }
            }
        }
        private global::System.Int64 _FileId;
        partial void OnFileIdChanging(global::System.Int64 value);
        partial void OnFileIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 DocumentId
        {
            get
            {
                return _DocumentId;
            }
            set
            {
                OnDocumentIdChanging(value);
                ReportPropertyChanging("DocumentId");
                _DocumentId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DocumentId");
                OnDocumentIdChanged();
            }
        }
        private global::System.Int64 _DocumentId;
        partial void OnDocumentIdChanging(global::System.Int64 value);
        partial void OnDocumentIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String DocName
        {
            get
            {
                return _DocName;
            }
            set
            {
                OnDocNameChanging(value);
                ReportPropertyChanging("DocName");
                _DocName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("DocName");
                OnDocNameChanged();
            }
        }
        private global::System.String _DocName;
        partial void OnDocNameChanging(global::System.String value);
        partial void OnDocNameChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int32 Sequence
        {
            get
            {
                return _Sequence;
            }
            set
            {
                OnSequenceChanging(value);
                ReportPropertyChanging("Sequence");
                _Sequence = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Sequence");
                OnSequenceChanged();
            }
        }
        private global::System.Int32 _Sequence;
        partial void OnSequenceChanging(global::System.Int32 value);
        partial void OnSequenceChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("MvcDemo.Dal.EntityModels", "FK_Files_Documents", "Documents")]
        public Document Document
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Document>("MvcDemo.Dal.EntityModels.FK_Files_Documents", "Documents").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Document>("MvcDemo.Dal.EntityModels.FK_Files_Documents", "Documents").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Document> DocumentReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Document>("MvcDemo.Dal.EntityModels.FK_Files_Documents", "Documents");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Document>("MvcDemo.Dal.EntityModels.FK_Files_Documents", "Documents", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("MvcDemo.Dal.EntityModels", "FK_FileVersions_Files", "FileVersions")]
        public EntityCollection<FileVersion> FileVersions
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<FileVersion>("MvcDemo.Dal.EntityModels.FK_FileVersions_Files", "FileVersions");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<FileVersion>("MvcDemo.Dal.EntityModels.FK_FileVersions_Files", "FileVersions", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="MvcDemo.Dal.EntityModels", Name="Document")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Document : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new Document object.
        /// </summary>
        /// <param name="documentId">Initial value of the DocumentId property.</param>
        /// <param name="updateDate">Initial value of the UpdateDate property.</param>
        /// <param name="documentName">Initial value of the DocumentName property.</param>
        /// <param name="isActive">Initial value of the IsActive property.</param>
        /// <param name="keywords">Initial value of the Keywords property.</param>
        public static Document CreateDocument(global::System.Int64 documentId, global::System.DateTime updateDate, global::System.String documentName, global::System.Boolean isActive, global::System.String keywords)
        {
            Document document = new Document();
            document.DocumentId = documentId;
            document.UpdateDate = updateDate;
            document.DocumentName = documentName;
            document.IsActive = isActive;
            document.Keywords = keywords;
            return document;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 DocumentId
        {
            get
            {
                return _DocumentId;
            }
            set
            {
                if (_DocumentId != value)
                {
                    OnDocumentIdChanging(value);
                    ReportPropertyChanging("DocumentId");
                    _DocumentId = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("DocumentId");
                    OnDocumentIdChanged();
                }
            }
        }
        private global::System.Int64 _DocumentId;
        partial void OnDocumentIdChanging(global::System.Int64 value);
        partial void OnDocumentIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime UpdateDate
        {
            get
            {
                return _UpdateDate;
            }
            set
            {
                OnUpdateDateChanging(value);
                ReportPropertyChanging("UpdateDate");
                _UpdateDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UpdateDate");
                OnUpdateDateChanged();
            }
        }
        private global::System.DateTime _UpdateDate;
        partial void OnUpdateDateChanging(global::System.DateTime value);
        partial void OnUpdateDateChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> UpdatedById
        {
            get
            {
                return _UpdatedById;
            }
            set
            {
                OnUpdatedByIdChanging(value);
                ReportPropertyChanging("UpdatedById");
                _UpdatedById = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UpdatedById");
                OnUpdatedByIdChanged();
            }
        }
        private Nullable<global::System.Int64> _UpdatedById;
        partial void OnUpdatedByIdChanging(Nullable<global::System.Int64> value);
        partial void OnUpdatedByIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String DocumentName
        {
            get
            {
                return _DocumentName;
            }
            set
            {
                OnDocumentNameChanging(value);
                ReportPropertyChanging("DocumentName");
                _DocumentName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("DocumentName");
                OnDocumentNameChanged();
            }
        }
        private global::System.String _DocumentName;
        partial void OnDocumentNameChanging(global::System.String value);
        partial void OnDocumentNameChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Boolean IsActive
        {
            get
            {
                return _IsActive;
            }
            set
            {
                OnIsActiveChanging(value);
                ReportPropertyChanging("IsActive");
                _IsActive = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("IsActive");
                OnIsActiveChanged();
            }
        }
        private global::System.Boolean _IsActive;
        partial void OnIsActiveChanging(global::System.Boolean value);
        partial void OnIsActiveChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String OwnerName
        {
            get
            {
                return _OwnerName;
            }
            set
            {
                OnOwnerNameChanging(value);
                ReportPropertyChanging("OwnerName");
                _OwnerName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("OwnerName");
                OnOwnerNameChanged();
            }
        }
        private global::System.String _OwnerName;
        partial void OnOwnerNameChanging(global::System.String value);
        partial void OnOwnerNameChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Keywords
        {
            get
            {
                return _Keywords;
            }
            set
            {
                OnKeywordsChanging(value);
                ReportPropertyChanging("Keywords");
                _Keywords = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Keywords");
                OnKeywordsChanged();
            }
        }
        private global::System.String _Keywords;
        partial void OnKeywordsChanging(global::System.String value);
        partial void OnKeywordsChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("MvcDemo.Dal.EntityModels", "FK_Files_Documents", "DocFiles")]
        public EntityCollection<DocFile> DocFiles
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<DocFile>("MvcDemo.Dal.EntityModels.FK_Files_Documents", "DocFiles");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<DocFile>("MvcDemo.Dal.EntityModels.FK_Files_Documents", "DocFiles", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("MvcDemo.Dal.EntityModels", "FK_RelatedDocuments_Documents", "RelatedDocuments")]
        public EntityCollection<RelatedDocument> RelatedDocuments
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<RelatedDocument>("MvcDemo.Dal.EntityModels.FK_RelatedDocuments_Documents", "RelatedDocuments");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<RelatedDocument>("MvcDemo.Dal.EntityModels.FK_RelatedDocuments_Documents", "RelatedDocuments", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("MvcDemo.Dal.EntityModels", "FK_RelatedDocuments_Documents1", "RelatedDocuments")]
        public EntityCollection<RelatedDocument> RelatedDocuments1
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<RelatedDocument>("MvcDemo.Dal.EntityModels.FK_RelatedDocuments_Documents1", "RelatedDocuments");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<RelatedDocument>("MvcDemo.Dal.EntityModels.FK_RelatedDocuments_Documents1", "RelatedDocuments", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="MvcDemo.Dal.EntityModels", Name="FileVersion")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class FileVersion : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new FileVersion object.
        /// </summary>
        /// <param name="fileVersionId">Initial value of the FileVersionId property.</param>
        /// <param name="fileId">Initial value of the FileId property.</param>
        /// <param name="path">Initial value of the Path property.</param>
        /// <param name="version">Initial value of the Version property.</param>
        /// <param name="isActive">Initial value of the IsActive property.</param>
        /// <param name="addedDate">Initial value of the AddedDate property.</param>
        public static FileVersion CreateFileVersion(global::System.Int64 fileVersionId, global::System.Int64 fileId, global::System.String path, global::System.Int32 version, global::System.Boolean isActive, global::System.DateTime addedDate)
        {
            FileVersion fileVersion = new FileVersion();
            fileVersion.FileVersionId = fileVersionId;
            fileVersion.FileId = fileId;
            fileVersion.Path = path;
            fileVersion.Version = version;
            fileVersion.IsActive = isActive;
            fileVersion.AddedDate = addedDate;
            return fileVersion;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 FileVersionId
        {
            get
            {
                return _FileVersionId;
            }
            set
            {
                if (_FileVersionId != value)
                {
                    OnFileVersionIdChanging(value);
                    ReportPropertyChanging("FileVersionId");
                    _FileVersionId = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("FileVersionId");
                    OnFileVersionIdChanged();
                }
            }
        }
        private global::System.Int64 _FileVersionId;
        partial void OnFileVersionIdChanging(global::System.Int64 value);
        partial void OnFileVersionIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 FileId
        {
            get
            {
                return _FileId;
            }
            set
            {
                OnFileIdChanging(value);
                ReportPropertyChanging("FileId");
                _FileId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("FileId");
                OnFileIdChanged();
            }
        }
        private global::System.Int64 _FileId;
        partial void OnFileIdChanging(global::System.Int64 value);
        partial void OnFileIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Path
        {
            get
            {
                return _Path;
            }
            set
            {
                OnPathChanging(value);
                ReportPropertyChanging("Path");
                _Path = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Path");
                OnPathChanged();
            }
        }
        private global::System.String _Path;
        partial void OnPathChanging(global::System.String value);
        partial void OnPathChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int32 Version
        {
            get
            {
                return _Version;
            }
            set
            {
                OnVersionChanging(value);
                ReportPropertyChanging("Version");
                _Version = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Version");
                OnVersionChanged();
            }
        }
        private global::System.Int32 _Version;
        partial void OnVersionChanging(global::System.Int32 value);
        partial void OnVersionChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Comment
        {
            get
            {
                return _Comment;
            }
            set
            {
                OnCommentChanging(value);
                ReportPropertyChanging("Comment");
                _Comment = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Comment");
                OnCommentChanged();
            }
        }
        private global::System.String _Comment;
        partial void OnCommentChanging(global::System.String value);
        partial void OnCommentChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Boolean IsActive
        {
            get
            {
                return _IsActive;
            }
            set
            {
                OnIsActiveChanging(value);
                ReportPropertyChanging("IsActive");
                _IsActive = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("IsActive");
                OnIsActiveChanged();
            }
        }
        private global::System.Boolean _IsActive;
        partial void OnIsActiveChanging(global::System.Boolean value);
        partial void OnIsActiveChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime AddedDate
        {
            get
            {
                return _AddedDate;
            }
            set
            {
                OnAddedDateChanging(value);
                ReportPropertyChanging("AddedDate");
                _AddedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("AddedDate");
                OnAddedDateChanged();
            }
        }
        private global::System.DateTime _AddedDate;
        partial void OnAddedDateChanging(global::System.DateTime value);
        partial void OnAddedDateChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int32> AddedBy
        {
            get
            {
                return _AddedBy;
            }
            set
            {
                OnAddedByChanging(value);
                ReportPropertyChanging("AddedBy");
                _AddedBy = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("AddedBy");
                OnAddedByChanged();
            }
        }
        private Nullable<global::System.Int32> _AddedBy;
        partial void OnAddedByChanging(Nullable<global::System.Int32> value);
        partial void OnAddedByChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String AddedByName
        {
            get
            {
                return _AddedByName;
            }
            set
            {
                OnAddedByNameChanging(value);
                ReportPropertyChanging("AddedByName");
                _AddedByName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("AddedByName");
                OnAddedByNameChanged();
            }
        }
        private global::System.String _AddedByName;
        partial void OnAddedByNameChanging(global::System.String value);
        partial void OnAddedByNameChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("MvcDemo.Dal.EntityModels", "FK_FileVersions_Files", "DocFiles")]
        public DocFile DocFile
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<DocFile>("MvcDemo.Dal.EntityModels.FK_FileVersions_Files", "DocFiles").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<DocFile>("MvcDemo.Dal.EntityModels.FK_FileVersions_Files", "DocFiles").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<DocFile> DocFileReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<DocFile>("MvcDemo.Dal.EntityModels.FK_FileVersions_Files", "DocFiles");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<DocFile>("MvcDemo.Dal.EntityModels.FK_FileVersions_Files", "DocFiles", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="MvcDemo.Dal.EntityModels", Name="RelatedDocument")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class RelatedDocument : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new RelatedDocument object.
        /// </summary>
        /// <param name="relatedDocumentId">Initial value of the RelatedDocumentId property.</param>
        /// <param name="masterDocumentId">Initial value of the MasterDocumentId property.</param>
        /// <param name="childDocumentId">Initial value of the ChildDocumentId property.</param>
        public static RelatedDocument CreateRelatedDocument(global::System.Int64 relatedDocumentId, global::System.Int64 masterDocumentId, global::System.Int64 childDocumentId)
        {
            RelatedDocument relatedDocument = new RelatedDocument();
            relatedDocument.RelatedDocumentId = relatedDocumentId;
            relatedDocument.MasterDocumentId = masterDocumentId;
            relatedDocument.ChildDocumentId = childDocumentId;
            return relatedDocument;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 RelatedDocumentId
        {
            get
            {
                return _RelatedDocumentId;
            }
            set
            {
                if (_RelatedDocumentId != value)
                {
                    OnRelatedDocumentIdChanging(value);
                    ReportPropertyChanging("RelatedDocumentId");
                    _RelatedDocumentId = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("RelatedDocumentId");
                    OnRelatedDocumentIdChanged();
                }
            }
        }
        private global::System.Int64 _RelatedDocumentId;
        partial void OnRelatedDocumentIdChanging(global::System.Int64 value);
        partial void OnRelatedDocumentIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 MasterDocumentId
        {
            get
            {
                return _MasterDocumentId;
            }
            set
            {
                OnMasterDocumentIdChanging(value);
                ReportPropertyChanging("MasterDocumentId");
                _MasterDocumentId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("MasterDocumentId");
                OnMasterDocumentIdChanged();
            }
        }
        private global::System.Int64 _MasterDocumentId;
        partial void OnMasterDocumentIdChanging(global::System.Int64 value);
        partial void OnMasterDocumentIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ChildDocumentId
        {
            get
            {
                return _ChildDocumentId;
            }
            set
            {
                OnChildDocumentIdChanging(value);
                ReportPropertyChanging("ChildDocumentId");
                _ChildDocumentId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ChildDocumentId");
                OnChildDocumentIdChanged();
            }
        }
        private global::System.Int64 _ChildDocumentId;
        partial void OnChildDocumentIdChanging(global::System.Int64 value);
        partial void OnChildDocumentIdChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("MvcDemo.Dal.EntityModels", "FK_RelatedDocuments_Documents", "Documents")]
        public Document Document
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Document>("MvcDemo.Dal.EntityModels.FK_RelatedDocuments_Documents", "Documents").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Document>("MvcDemo.Dal.EntityModels.FK_RelatedDocuments_Documents", "Documents").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Document> DocumentReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Document>("MvcDemo.Dal.EntityModels.FK_RelatedDocuments_Documents", "Documents");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Document>("MvcDemo.Dal.EntityModels.FK_RelatedDocuments_Documents", "Documents", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("MvcDemo.Dal.EntityModels", "FK_RelatedDocuments_Documents1", "Documents")]
        public Document Document1
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Document>("MvcDemo.Dal.EntityModels.FK_RelatedDocuments_Documents1", "Documents").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Document>("MvcDemo.Dal.EntityModels.FK_RelatedDocuments_Documents1", "Documents").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Document> Document1Reference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Document>("MvcDemo.Dal.EntityModels.FK_RelatedDocuments_Documents1", "Documents");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Document>("MvcDemo.Dal.EntityModels.FK_RelatedDocuments_Documents1", "Documents", value);
                }
            }
        }

        #endregion
    }

    #endregion
    
}
