ExecuteStoreQuery passing parameter to StoreProcedure
- by KDM
Could someone help with passing a parameter object into my ExecuteStoreQuery. Im executing this from my Entities db and then creating my procedure on the fly is this possible and is my SQL correct. i need to pass a Id paramater value into my sql statement
var node = db.ExecuteStoreQuery<Node>(@"
@Id int // not sure about this declaration for paramater
with c as (
select Id, Name, ParentId,[0] as level
from Department d
union all
select d.Id, d.Name, d.ParentId, [level] + 1
from Department d
join c on d.ParentId = c.Id)
select * from c where c.Id = @Id"
"Departments",
System.Data.Objects.MergeOption.NoTracking,
new object{ Id: department.Id} // <--paramater object not working);