Page 1 of 1

Inserting data with 2 Primary keys

Posted: Fri 02 Oct 2009 21:00
by pinkgorilla
hi, i have a problem when inserting with a data to an oracle table having 2 primary keys.
i'm using Entity Developer for dotConnect to generate Devart LINQ to SQL Model. and Visual Studio 2008

here's my case:

the table:

-----------------------
MyTable
-----------------------
pk1 varchar2(50) //primary key
pk2 varchar2(50) //primary key
Content CLOB
Data BLOB

----------------
the code:
----------------
MyTableDataContext _context = new MyTableDataContext();
MyTable _entity = new MyTable();
_entity.pk1 = "key1";
_entity.pk2 = "key2";

//i do not give value to the other fields and i don't think thats the cause for the problem i have

_context.MyTables.InsertOnSubmit(_entity);
_context.SubmitChanges();


now after i run the code, i get an exception of System.InvalidOperationException : Sequence contains no matching element on _context.MyTables.InsertOnSubmit(_entity);


i wonder what is wrong with my code? the code runs perfectly with tables with 1 primary key.

anyone could help?

Posted: Mon 05 Oct 2009 13:40
by AndreyR
I have tried to reproduce the problem using the latest 5.25.44 build of dotConnect for Oracle and failed.
What is the full version of dotConnect for Oracle you are using?
Also, please post the call stack of the error here.

Posted: Tue 06 Oct 2009 04:43
by pinkgorilla
hello AndreyR, here's the stack trace produced by the Exception:

Code: Select all

   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at Devart.Data.Linq.MultiKeyManager`2.a()
   at Devart.Data.Linq.MultiKeyManager`2.a(Type A_0)
   at Devart.Data.Linq.MultiKeyManager`2.a(Type A_0)
   at Devart.Data.Linq.MultiKeyManager`2.CreateDefault[TType]()
   at Devart.Data.Linq.MultiKeyManager`2.CreateKeyFromInstance(T obj)
   at Devart.Data.Linq.KeyManager`2.a(Object A_0)
   at Devart.Data.Linq.Table`1.a(Object A_0, MetaType A_1)
   at Devart.Data.Linq.Table`1.b(Object A_0, MetaType A_1, Dictionary`2 A_2)
   at Devart.Data.Linq.Table`1.c(Object A_0, MetaType A_1)
   at Devart.Data.Linq.Table`1.InsertOnSubmit(TEntity entity)
   at _Default.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\Tris\My Documents\Visual Studio 2008\WebSites\LintasArta.Humanis\Default.aspx.cs:line 25
   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
and i'm using dotConnect for Oracle version 5.25.39

Posted: Wed 07 Oct 2009 07:38
by AndreyR
I recommend you to update to the latest 5.25.44 build of dotConnect for Oracle.

Posted: Fri 30 Oct 2009 15:25
by motuzko
Have same issue using 5.25.49
The worst thing is that it works on one box and does not work on the other

Posted: Fri 30 Oct 2009 15:59
by AndreyR
First, are the call stacks from this and the previous case identical?
Also I recommend you to check that the versions of our LINQ assemblies are latest ones
(you can check it in the Modules window (Debug->Windows->Modules)).