This question is locked. New answers and comments are not allowed.
Hi,
I just switched from L2S to OA. I have new ASP.NET database application using OpenAccess. In database I have two tables, Baskets and Files. Between then is N:M relation, so there is third table BasketFiles with BasketId and FileId columns. I created this relation in OA object designer, si BasketFiles table is hidden and I don't have explicit access to it.
No problem with reading or modifying, but I'm not able to selectively delete "file" objects from basket. If I try to remove then with this code:
I get some sort of error like Entity removed, enumeration cant continue... There is no "selectedBasket.Files.Delete (file as Gaia.File)" method in OpenAccess Linq.
In "standard" LINQ I would use eg
dc.BasketFiles.Delete (files.Where (Function (q) selectedIds.Contains(q.fileId)))
But no Delete method for object in available OpenAccess ...
Thank you for your help.
Zdenek
I just switched from L2S to OA. I have new ASP.NET database application using OpenAccess. In database I have two tables, Baskets and Files. Between then is N:M relation, so there is third table BasketFiles with BasketId and FileId columns. I created this relation in OA object designer, si BasketFiles table is hidden and I don't have explicit access to it.
No problem with reading or modifying, but I'm not able to selectively delete "file" objects from basket. If I try to remove then with this code:
Dim
selectedIds
As
List(Of
Integer
) = UIHelpers.GetSelectedPrimaryKeys(rgFiles,
"FileId"
)
'get list of integers (selected primary keys from RadGrid
For
Each
file
In
selectedBasket.Files
' List of File items (those are not IO.File!, it is normal db entity)
If
selectedIds.Contains(file.FileId)
Then
selectedBasket.Files.Remove(file)
Next
In "standard" LINQ I would use eg
dc.BasketFiles.Delete (files.Where (Function (q) selectedIds.Contains(q.fileId)))
But no Delete method for object in available OpenAccess ...
Thank you for your help.
Zdenek