ProdigyOne2k
asked on
Using a DomainService with CRUD statements (Silverlight)
In my DomainService which is accessing a ADO.NET (.edmx) file I have the following function which returns ALL columns
Public Function GetOpenPOs() As IQueryable(Of PartNumberHistory)
Return Me.ObjectContext.PartNumbe rHistories .Where(Fun ction(e) e.OpenClosed = "OPEN PO" And e.NumOfQty = 1 And e.LineItem = 1).OrderBy(Function(e) e.PO)
End Function
This works great and when I edit the grid and click "Submit Changes" button - everything is saved - works like a charm
Problem is I *want* to only return (and be able to edit) a few of the columns....
I try this function
Public Function GetOpenPOs() As IQueryable(Of PartNumberHistory)
Return Me.ObjectContext.PartNumbe rHistories .Where(Fun ction(e) e.OpenClosed = "OPEN PO" And e.NumOfQty = 1 And e.LineItem = 1).OrderBy(Function(e) e.PO).Select(Function(e) e.PO)
End Function
But get the error:
Error 1 'System.Linq.IQueryable(Of String)' cannot be converted to 'System.Linq.IQueryable(Of BusinessApplication9.PartN umberHisto ry)' because 'String' is not derived from 'BusinessApplication9.Part NumberHist ory', as required for the 'Out' generic parameter 'T' in 'Interface IQueryable(Of Out T)'.
How can I make this work? The client seeing all of the columns is just overkill
Thanks!
Public Function GetOpenPOs() As IQueryable(Of PartNumberHistory)
Return Me.ObjectContext.PartNumbe
End Function
This works great and when I edit the grid and click "Submit Changes" button - everything is saved - works like a charm
Problem is I *want* to only return (and be able to edit) a few of the columns....
I try this function
Public Function GetOpenPOs() As IQueryable(Of PartNumberHistory)
Return Me.ObjectContext.PartNumbe
End Function
But get the error:
Error 1 'System.Linq.IQueryable(Of
How can I make this work? The client seeing all of the columns is just overkill
Thanks!
The select statement on the end is changing your return type. Try removing that, and you should get a list of the entities back.
like this:
Return Me.ObjectContext.PartNumbe rHistories .Where(Fun ction(e) e.OpenClosed = "OPEN PO" And e.NumOfQty = 1 And e.LineItem = 1).OrderBy(Function(e) e.PO)
like this:
Return Me.ObjectContext.PartNumbe
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
See if this helps you
http://forums.silverlight.net/forums/p/171512/387088.aspx
Thanks and regards,
Venki