We have a database that contains xml fields. At this moment we perform queries on this database that filter on values in the xml. In the near future we would like to migrate to entity framework or NHibernate as orm. Is this possible? This are two of the queries we run (in sql):
SELECT
yy.[Description] as Name,
convert(xml, yy.Xml).value('(//Division)[1]', 'varchar(255)') as Division,
onvert(xml, yy.Xml).value('(//Season)[1]', 'varchar(255)') as Season
into #Statistics .....
And
SELECT [dbo].[yy].[Id]
FROM [dbo].[yy]
WHERE [dbo].[yy].[ApplicationId] = 1
AND (((dbo.[yy].Xml.exist(''(//qq[Season='Non seasonal'])'') = 1)))
Is there anyway to do this?
In EF there are a variety of ways to pass SQL directly through to the server, e.g.
ObjectContext.ExecuteStoreQuery. You could also write a stored proc which does the xpath query and map that as usual. There is no native support for xpath in LINQ or Entity SQL, as far as I know.