I have the following IAccountService interface. I also have the same interfaces for the product and package, etc.
public interface IAccountService { void AddOrUpdate(Account account); void Delete(Account account); bool DoesTableExist(); Account Get(Account account); Account Get(string pk, string rk); IEnumerable<Account> Get(); IEnumerable<Account> Get(string pk); string GetOptions(string pk, string rk); IEnumerable<AccountDetail> ShowDetails(ref string runTime); IEnumerable<AccountSummary> ShowSummary(ref string runTime); void ValidateNoDuplicate(Account account); void ValidateNoProducts(Account account); }
I have created some common methods, but I am wondering if I can create a common interface. If so, how would I call it and how could I change above to make it general. I am currently using this interface as follows:
public class AccountService : BaseService, IAccountService
Update 1
Thanks for all the suggestions. The only thing I came across was the AccountDetail and AccountSummary classes. I think it should be subclasses. But how can I handle this name? I would need to take the class name, add the part, and then use it in the interface. Is it possible?
Update 2
Here is an example of detailed and summary classes:
public class AccountDetail { public string Title { get; set; } public string Product { get; set; } } public class AccountSummary { public string Title { get; set; } public Int32? ProductCount { get; set; } public string PartitionKey{ get; set; } public string RowKey { get; set; } public DateTime? Modified { get; set; } public string ModifiedBy { get; set; } }
The above classes are used for reporting. I think that they probably should not be part of the model repository. Maybe they should be somewhere else.
Regarding comments ref. There is a link because in my controller I call the following method:
_account.ShowDetails(ref runTime);
The result of ShowDetails is a list of details, and the runTime link is updated to reflect the time it takes to run the report.
source share