Originally I believed that
context.Configuration.AutoDetectChangesEnabled = false;
would disable change tracking. But no. Cur
In my case since I needed the whole context to be readonly rather than Read/Write.
So I did a change to the tt file, and changed all the DbContext properties to return DbQuery instead of DbSet, removed the sets from all properties, and for the gets, I returned the Model.AsNoTracking()
For example:
public virtual DbQuery Campaigns { get{ return Set().AsNoTracking();} }
The way I did this in the tt template is:
public string DbQuery(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbQuery<{1}> {2} {{ get{{ return Set<{1}>().AsNoTracking();}} }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}