//------------------------------------------------------------------------------ // <auto-generated> // This code was generated from a template. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data.Common; using System.Data.EntityClient; using System.Data.Metadata.Edm; using System.Data.Objects.DataClasses; using System.Data.Objects; using System.Data; using System.Diagnostics; using System.Globalization; using System.Linq; namespace SchoolSample.EntityModel { public partial class SchoolEntities : ObjectContext { public const string ConnectionString = "name=SchoolEntities"; public const string ContainerName = "SchoolEntities"; #region Constructors public SchoolEntities() : base(ConnectionString, ContainerName) { Initialize(); } public SchoolEntities(string connectionString) : base(connectionString, ContainerName) { Initialize(); } public SchoolEntities(EntityConnection connection) : base(connection, ContainerName) { Initialize(); } private void Initialize() { // Creating proxies requires the use of the ProxyDataContractResolver and // may allow lazy loading which can expand the loaded graph during serialization. ContextOptions.ProxyCreationEnabled = false; ObjectMaterialized += new ObjectMaterializedEventHandler(HandleObjectMaterialized); } private void HandleObjectMaterialized(object sender, ObjectMaterializedEventArgs e) { var entity = e.Entity as IObjectWithChangeTracker; if (entity != null) { bool changeTrackingEnabled = entity.ChangeTracker.ChangeTrackingEnabled; try { entity.MarkAsUnchanged(); } finally { entity.ChangeTracker.ChangeTrackingEnabled = changeTrackingEnabled; } this.StoreReferenceKeyValues(entity); } } #endregion #region ObjectSet Properties public ObjectSet<Course> Courses { get { return _courses ?? (_courses = CreateObjectSet<Course>("Courses")); } } private ObjectSet<Course> _courses; public ObjectSet<Enrollment> Enrollments { get { return _enrollments ?? (_enrollments = CreateObjectSet<Enrollment>("Enrollments")); } } private ObjectSet<Enrollment> _enrollments; public ObjectSet<Person> People { get { return _people ?? (_people = CreateObjectSet<Person>("People")); } } private ObjectSet<Person> _people; #endregion } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)