mfenniak / rethinkdb-net

A C# / .NET client driver for RethinkDB.
Other
247 stars 37 forks source link

Additional non-DataMember Properties cause exception when using Change() #219

Closed sceee closed 9 years ago

sceee commented 9 years ago

First of all, thank you very much for supporting the change() feature on a table.

But unfortunately, I faced a problem when trying to use it. I got a DTO class which contains several properties, some attributed with DataMember and some don't. Regarding storing and reading from the DB everything works as expected but when I register change events for a Table, I face an exception for one of the properties which are not DataMember attributed.

"Additional information: Member XYZ on type System.Collections.Generic.List`1[System.String] could not be mapped to a datum field". This is a property which is defined in the DTO without the DataMember attribute so. The exception happens in BaseExpression.ServerSideMemberAccess(..), line 232.

Regarding reproduction: 1) Create a table with desired DTO 2) Create get-only property without DataMember attribute in this DTO 3) Register a change event listener like

using (var conn = DatabaseConnection)
   {
      foreach (var change in conn.Run(DB.Table<MyDTO>("TABLE_NAME").Changes(), cancellationToken: stopMonitoring.Token))
      {
      ...
      }
   }

4) Insert something in the table and the exception occurs.

sceee commented 9 years ago

I'm sorry, I made a mistake when debugging this. When trying to reproduce this I realized the problem does not come from the Change() query but from another one running at the same time. I reported this issue here: https://github.com/mfenniak/rethinkdb-net/issues/220

So I will close this.