开发者

C# Data Access GetAll() methods with many parameters

开发者 https://www.devze.com 2023-02-03 08:49 出处:网络
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,

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

精彩评论

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