开发者

In Entity Framework, what is the parent type of all ObjectQuery fields?

I need to

OrderBy( p => new SomeClass {p.firstField, p.secondField} )

where

public class SomeClass<T>
{    T firstField {get;set;}
     T secondField {get;set;}
}

What is the most specific Entity Framework 4 type that T can be?

What code could I use to set firstFi开发者_如何学运维eld's and secondField's value?

(meaning I want firstField to reference p.ID and secondField to reference p.Name).


The type of the fields are the normal .NET types. This means that when firstField references to ID, this will probably be an int or a Guid and secondField will probably be a string.

If you are creating a generic class to do ordering with, this is not necessary. You can also do this:

OrderBy( p => new { p.ID, p.Name } )

This will automatically create a type for you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜