How do I define a property to read an attribute from, without instantionating an object?

前端 未结 5 1427
名媛妹妹
名媛妹妹 2021-01-23 10:00

Suppose I have:

class Person
{
[ColumnAttribute(\"ID\"]
    public int Id;
[ColumnAttribute(\"Name\"]
public string Name;
[ColumnAttribute(\"DateOfBirth\"]
    p         


        
5条回答
  •  悲哀的现实
    2021-01-23 10:43

    Is there a specific reason to force ordering on the GetAllByAge() method itself? Why not just sort it once you get it back? Does the order by logic need to happen server side? I would return a List (which you mentioned doing yourself) and use LINQ to order the set as needed, unless I had a really good reason not to:

    Dal.Person.GetAllByAge(25).OrderBy(p => p.BirthDate);
    

提交回复
热议问题