Hi Eugene, does this solve all missing PK problems? Pascal.
On Thu, Nov 20, 2008 at 21:29, Eugene Kotlyarov <[EMAIL PROTECTED]>wrote: > I get following exception when selecting from table that has no primary key > > Unhandled exception: System.InvalidOperationException: Sequence contains no > elements > в System.Linq.Enumerable.First[TSource](IEnumerable`1 source) > в DbLinq.Data.Linq.DataContext.SetEntitySetsQueries(Object entity) в > c:\Documents and Settings\e_kotlyarov\Мои > > документы\work\dblinq2007-read-only\src\DbLinq\Data\Linq\DataContext.cs:строка > 521 > в DbLinq.Data.Linq.DataContext._GetOrRegisterEntity(Object entity) в > c:\Documents and Settings\e_kotlyarov\Мои > > документы\work\dblinq2007-read-only\src\DbLinq\Data\Linq\DataContext.cs:строка > 435 > в DbLinq.Data.Linq.DataContext.Register(Object entity) в c:\Documents > and Settings\e_kotlyarov\Мои > > документы\work\dblinq2007-read-only\src\DbLinq\Data\Linq\DataContext.cs:строка > 621 > в > DbLinq.Data.Linq.Sugar.Implementation.QueryRunner.<Select>d__0`1.MoveNext() > в c:\Documents and Settings\e_kotlyarov\Мои > > документы\work\dblinq2007-read-only\src\DbLinq\Data\Linq\Sugar\Implementation\QueryRunner.cs:строка > 90 > в Program.Main(String[] args) > > Line that causes error is > object primaryKeyValue = (thisPKs.First() as PropertyInfo).GetValue(entity, > null); > > because thisPKs is empty. I made quick fix for it in attach, point of it is > that it only tries to get primaryKeyValue only if it would be used further > in procedure. > > > > -- Pascal. jabber/gtalk: [EMAIL PROTECTED] msn: [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DbLinq" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/dblinq?hl=en -~----------~----~----~----~------~----~------~--~---
