ArtifactRepo.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using BO.AppServer.Data.Entity;
  4. using Quadarax.Foundation.Core.Data;
  5. using Quadarax.Foundation.Core.Data.Domain;
  6. using Quadarax.Foundation.Core.Data.Interface.Domain;
  7. using Quadarax.Foundation.Core.Data.Repository;
  8. namespace BO.AppServer.Data.Repository
  9. {
  10. public class ArtifactRepo : EntityRepository<long, Artifact>
  11. {
  12. public ArtifactRepo(IUnitOfWork<DataDomain> unitOfWork) : base(unitOfWork)
  13. {
  14. }
  15. public Artifact GetArtifact(long metadocumentId, long artifactId)
  16. {
  17. return Query(new Paging()).FirstOrDefault(x => x.MetadocumentId == metadocumentId && x.Id== artifactId);
  18. }
  19. public IEnumerable<Artifact> GetArtifacts(long metadocumentId)
  20. {
  21. return Query(new Paging()).Where(x => x.MetadocumentId == metadocumentId);
  22. }
  23. public Artifact GetArtifactByName(long metadocumentId, string nameWithoutExtension, string extension)
  24. {
  25. return Query(new Paging()).FirstOrDefault(x => x.Id == metadocumentId && x.Name.ToLower() == nameWithoutExtension.ToLower() && x.Extension.ToLower() == extension.ToLower());
  26. }
  27. }
  28. }