Example #1
0
 public override IEnumerable <Company> All(int maxAllowed = 10)
 {
     if (!(maxAllowed <= 0 || maxAllowed == int.MaxValue))
     {
         var count = RepositoryDbSet.Count();
         if (count > maxAllowed)
         {
             throw new ApplicationException($"Too many rows in result! {typeof(CompanyFieldOfActivity).FullName}");
         }
     }
     return(RepositoryDbSet
            .ToList());
 }
 public override IEnumerable <ProjectType> All(int maxAllowed = 10)
 {
     if (!(maxAllowed <= 0 || maxAllowed == int.MaxValue))
     {
         var count = RepositoryDbSet.Count(); // select count(*) from dbset
         if (count > maxAllowed)
         {
             throw new ApplicationException($"Too many rows in result! {typeof(ProjectType).FullName} {count}/{maxAllowed}");
         }
     }
     return(RepositoryDbSet
            .Include(t => t.ProjectTypeComments)
            .ThenInclude(t => t.Translations).ToList());
 }