should I create a new class for a specific piece of business logic?
Posted
by
Riz
on Programmers
See other posts from Programmers
or by Riz
Published on 2013-06-28T17:05:56Z
Indexed on
2013/06/28
22:28 UTC
Read the original article
Hit count: 174
.NET
|single-responsibility
I have a Request class based on the same Entity in my Domain. It currently only has property definitions. I'd like to add a method for checking a duplicate Request which I'll call from my controller. Should I add a method called CheckDuplicate in the Request class? Would I be violating the SRP? The method will need to access a database context to check already existing requests. I'm thinking creating another class altogether for this logic that accepts a datacontext as part of its constructor. But creating a whole new class for just one method seems like a waste too. Any advice?
© Programmers or respective owner