Hi guys and gals,
First of all, apologies if this is in the wrong section, but not quite sure where this would be classified.
I have an issue where the wrong SQL is being generated from a Many-to-Many collection mapping using the old reverse mapped managed class model.
A situation schema I have is as follows:
- Table1K bigint PK NOT NULL
- Table1FK -> NameSpace2.Table1K
- Table2FK -> dbo.Table2K
- Table2K bigint PK NOT NULL
They have been setup in the reverse engineering wizard and mapped appropriately as collections on the owner objects, however when I try to access the collections, like as follows
scope.Extent<Table2>().Where(i => i.Table1s.Count > 0)
OpenAccess generates something like this:
Telerik.OpenAccess.Exceptions.DataStoreException: Error executing query: Telerik.OpenAccess.RT.sql.SQLException: Invalid object name 'Table1InTable2'.
Statement(s) could not be prepared.
SELECT a.[Table2K] AS COL1 FROM [Table2] a WHERE (SELECT COUNT(*) FROM [Table1InTable2] b WHERE a.[Table2K] = b.[Table2FK]) > 0 Telerik.OpenAccess.RT.sql.SQLException: Invalid object name 'Table1InTable2'.
Another apology for the mock-up and I may have gotten the fakes wrong, but you should get the idea. I'm having trouble getting OA to include the schema namespace, shouldn't it generate [Namespace2].[Table1InTable2], or is it something I have misconfigured?
Can anyone help?
Many thanks in advance,