开发者

C# Data Access GetAll() methods with many parameters

It's common to have methods like one below in the data access layer:

    Tuple<int, IList<Media>> GetAllWithFilter(int? page, string folderName, string title, string fileName, string author, string keywordTitle, int type, int fileType, int rowsPerPage, Guid keywordId, string sortField = null, string sortDir = null);

And it get's 开发者_如何学Pythonmessier and messier every time a new property is added

What are the good practices to keep these methods readable and maintainable?

Thank You


Why not create an object that houses all your filter properties and just pass that around?


I think this one would help. Query pattern

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜