Hallo, ik zit met een vreemd probleempje.
Tabel dbPlayListOnSystems:
PlaylistID (PK,FK,uniqueidentifier, not null)
SystemID (PK,FK,uniqueidentifier, not null)
Tabel dbPlayList:
Guid (pk, uniqueidentifier, not null)
XML (XML(.), not null)
ScheduleGUID(FK, uniqueidentifier, null)
UserId(FK,uniqueidentifier, not null)
Gridview heet GvPlaylists.
Relevante code:
Bovenstaande code gaat goed.
Echter, als ik van de XML in de database, wat volgens linq een XElement is (jóh!) de Elements.Count op wil vragen en wil binden:
krijg ik deze Exception:
Het stomme is, dat het WEL lukt als ik een selectie doe rechtstreeks uit datacontext.dbPlayList. Hoe kan dit?
Overigens gaat playlist.dbPlayList.XML.Elements().Name ofzo wel gewoon goed
Tabel dbPlayListOnSystems:
PlaylistID (PK,FK,uniqueidentifier, not null)
SystemID (PK,FK,uniqueidentifier, not null)
Tabel dbPlayList:
Guid (pk, uniqueidentifier, not null)
XML (XML(.), not null)
ScheduleGUID(FK, uniqueidentifier, null)
UserId(FK,uniqueidentifier, not null)
Gridview heet GvPlaylists.
Relevante code:
C#:
1
2
3
4
5
6
7
8
9
10
11
12
| var playlists = from playlist in datacontext.dbPlayListOnSystems where playlist.SystemID.Equals(systemGuid) select new { playlist.dbPlayList, id = playlist.dbPlayList.GUID, name = "HIERKOMTDEPLAYLISTNAAM", }; GvPlaylists.DataSource = playlists; GvPlaylists.DataBind(); |
Bovenstaande code gaat goed.
Echter, als ik van de XML in de database, wat volgens linq een XElement is (jóh!) de Elements.Count op wil vragen en wil binden:
C#:
1
2
3
4
5
6
7
8
9
10
11
12
| var playlists = from playlist in datacontext.dbPlayListOnSystems where playlist.SystemID.Equals(systemGuid) select new { playlist.dbPlayList, id = playlist.dbPlayList.GUID, name = "HIERKOMTDEPLAYLISTNAAM", elementCount = playlist.dbPlayList.XML.Elements().Count(), }; GvPlaylists.DataSource = playlists; GvPlaylists.DataBind(); |
krijg ik deze Exception:
Deze treed op bij deMethode System.Collections.Generic.IEnumerable`1[System.Xml.Linq.XElement] Elements() heeft geen ondersteunde vertaling naar SQL.
C#:
methode.1
| GvPlaylists.DataBind(); |
Het stomme is, dat het WEL lukt als ik een selectie doe rechtstreeks uit datacontext.dbPlayList. Hoe kan dit?
Overigens gaat playlist.dbPlayList.XML.Elements().Name ofzo wel gewoon goed
