开发者

Entity Framework 4 Stored procedure Should I use Complex Type

I have 2 tables

Customer Order

2 Classes

Customer Id-Name

Order Id-Description. CustomerName

My s开发者_如何转开发tored procedure returns all orders with the customerName as well. I have used the normal mapping to a Entities =OrderTable

However my customerName is not populated even though the sp returns it.

Should I use a complex type when you have an sp like

     Select or.Id,or.Description,c.CustomerName
     from order or
     join Customer c on c.CustID=or.CustId
     where or.OrderId=1

The above is just an example to explain my question.

Not sure but looks like I should use complex no?

Any suggestions?


Since your Orders entity does not have CustomerName, it won't be returned unless you create a complex type that includes all resulting columns from the stored procedure. Another option would be to use a projection or an anonymous type in a simple Linq query, which might work just as well for a query that is this simple.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜