ORM test example issue

Sep 24, 2012 at 5:31 PM

Recently looking for a ORM tool for my windows mobile 6 project

Your project looks suitable for me (easy learning & light-weight), but when I'm try the example from the source code, I found some problems,

Inside the SqlCeTest class, RunTests() function

Once I commented the below code

//TestCascadingInsert(tests);
//TestCascadingUpdates(tests);

Before I calling TestGetAllBooks(test);

It will occur a error

{"Seek/SetRange requires that you specify table index on the SqlCeCommand instance before calling those methods."}

at System.Data.SqlServerCe.SqlCeDataReader.Seek(DbSeekOptions dbSeekOptions, Object[] index)
   at OpenNETCF.ORM.SqlCeDataStore.Select(String entityName, Type objectType, IEnumerable`1 filters, Int32 fetchCount, Int32 firstRowOffset, Boolean fillReferences)
   at OpenNETCF.ORM.SqlCeDataStore.Select(Type objectType, IEnumerable`1 filters, Int32 fetchCount, Int32 firstRowOffset, Boolean fillReferences)
   at OpenNETCF.ORM.SQLStoreBase`1.Select(Type objectType, String searchFieldName, Object matchValue, Int32 fetchCount, Int32 firstRowOffset, Boolean fillReferences)
   at OpenNETCF.ORM.SQLStoreBase`1.Select(Type objectType, String searchFieldName, Object matchValue, Int32 fetchCount, Int32 firstRowOffset)
   at OpenNETCF.ORM.SQLStoreBase`1.FillReferences(Object instance, Object keyValue, ReferenceAttribute[] fieldsToFill, Boolean cacheReferenceTable)
   at OpenNETCF.ORM.SqlCeDataStore.Select(String entityName, Type objectType, IEnumerable`1 filters, Int32 fetchCount, Int32 firstRowOffset, Boolean fillReferences)
   at OpenNETCF.ORM.SqlCeDataStore.Select(Type objectType, IEnumerable`1 filters, Int32 fetchCount, Int32 firstRowOffset, Boolean fillReferences)
   at OpenNETCF.ORM.SQLStoreBase`1.Select(Type objectType, String searchFieldName, Object matchValue, Int32 fetchCount, Int32 firstRowOffset, Boolean fillReferences)
   at OpenNETCF.ORM.SQLStoreBase`1.Select(Type objectType, String searchFieldName, Object matchValue, Int32 fetchCount, Int32 firstRowOffset)
   at OpenNETCF.ORM.SQLStoreBase`1.Select[T]()
   at SDP_Test.SqlCeStoreTest.GetAllBooks()
   at SDP_Test.SqlCeTest.TestGetAllBooks(List`1 tests)
   at SDP_Test.SqlCeTest.RunTests()
   at SDP_Test.FrmMain.btnProcess_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.ButtonBase.WnProc(WM wm, Int32 wParam, Int32 lParam)
   at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
   at Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)
   at System.Windows.Forms.Application.Run(Form fm)
   at SDP_Test.Program.Main()

 

TestCascadingInsert(tests);
TestCascadingUpdates(tests);

once I uncommented the above code, the example can be completed to run again

It seems that the index of Author referring from Book is not setup correctly on before the above 2 commands.

And any advise when my project will heavily rely on references between difference entities (especially many to many relationship)

Sorry for long message, thank you very much

Regards,

Kenneth

Coordinator
Sep 26, 2012 at 3:21 PM

Thanks for the report, it definitely was a bug where the Index name wasn't getting set on every Select (it was getting set on an Insert, so if you did an Insert before a Select you wouldn't see the issue).  The latest change set fixes this issue.