0

I'm using Self Tracking Entities that implements IObjectWithChangeTracker with the last Entity Framework RC available as a Nuget. The target database is PostgreSQL. I'm also using Code First fluent API to construct the model and LINQ to Entity for querying the database.

To my surpise, a simple SELECT query on the entity generates a SQL query with a mysterious column ChangeTracker_ChangeTrackingEnabled that does not exist in the datatable ! I do not understand this behavior as it seems to me that the EntityTypeConfiguration derived class maps the entity properties to the datatable columns in its constructor.

Is there a way to disable this behavior or at least tell which column should be mapped by the change tracker ?

For that purpose, Context.Configuration.AutoDetectChangesEnabled = false or calling IsConcurrencyToken() mapping in the EntityTypeConfiguration derived object does not help.

Any help appreciated.

TIA.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670

1 Answers1

0

You must inform EF about every public property you want to avoid in mapping by either marking property with NotMapped attribute or by using Ignore in fluent API.

Btw. as I know STEs are not designed to be used with code first or DbContext API.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
  • Thanks, adding this.Ignore(t => t.ChangeTracker); in the EntityTypeConfiguration derived class constructor solved the problem. –  Jun 20 '12 at 11:02
  • About your other comment, what about the solution you suggested on [this thread](http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/eba74567-e387-4eb1-a5ea-5387c25e3ac8) ? –  Jun 21 '12 at 07:00