views:

25

answers:

0

There is an existing sproc that for the purposes of this experiment I do not want to change. It is currently called via a non-linq method like a sqlcommand and takes an xml parameter.

Current implementation (Non-Linq)

An xml fragment eg:

"<someTag>1</someTag><someTag>2</someTag>" 

is passed to the sproc as a string. Notice that it does not have a containing root element like

<someTags>.

In this implementation the sproc happily accepts this xml fragment as a string and works

LINQ implementation

If i try and call this sproc from LINQ then LINQ demands that i must use an Xelement. Unfortunately the current xml fragment cannot be added to a Xelement because an Xelement cannot have multiple roots.

If I add a root element the sproc will not work.

What do i want

I already know that i can change the xpath in the sproc to make it work in both scenarios. I don't want to do this though

Hence, is it possible to have LINQ generate a parameter for this sproc that is not a Xelement without manually modifying the generated code?

OR

Is it possible to have an Xelement with multiple roots (i doubt it, but hey it's worth a shot)

Thanks