Hi
I originally was attempting to load objects to update them by creating an object representation of my base table and adding the key information required to pull back an object (my table has and index of 2 fields). I have this working in one project like so:
// Create Table object
tableObject to = new tableObject;
to.Key1 = value1;
to.Key2 = value2;
session.Load(typeof(tableObject), to);
to.Field = newValue1;
session.Flush() ;
The code appears to be working correctly and has for the past 4 months. However I cannot replicate this kind of functionality in my most recent attempts. I am getting an error when I try to place an object in the .Load to represent a complex key. It works if I insert a single value but not an object like:
session.Load(typeof(tableObject), keyValue);
to.Field = newValue1;
session.Flush() ;
The documentation looks this way as well. What does one do with a multi-columned key on the table if you cannot submit an object without getting
a
Exception: System.InvalidCastException
Message: Object must implement IConvertible.
message? I am currently testing with version 7.
Thanks.
|