Disable ChangeTracking with EF 6.0 RRS feed

  • Question

  • User-1129879462 posted

    I am wondering how can I really disable ChangeTracking per entity using Entity Framework 6.0 by calling AsNoTracking() method.

    Here's my DataContext

    using System;
    using System.Diagnostics;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.Entity;
    using System.Data.Entity.Infrastructure;
    using System.Data.Entity.ModelConfiguration.Conventions;
    using System.Data.Entity.Validation;
    //using System.Data.Objects;
    using System.Linq;
    using System.Linq.Expressions;
    using System.Web;
    namespace OrgData
    	public class DataContext : DbContext, IDbContext
    		#region Constructors
    		static DataContext()
    			// Set the db initialize to null so EF doesn't try to create our database for us
    		public DataContext(): base ("Name=Conn")
    			this.Configuration.AutoDetectChangesEnabled = false;
    		#region Data Sets
    		public DbSet<Project> Projects


    Could not install any of those packages!

    Any help would be appreciated.

    Monday, December 18, 2017 10:56 AM

All replies

  • User1120430333 posted

    For a Web application, EF Changetracking doesn't work, because Web applications are stateless  and EF is not kept in state for Changetracking to work. EF Changetracking works for Windows desktop solutions that are always kept in state.

    Monday, December 18, 2017 5:27 PM