ArtifactRepo.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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. DefaultIncludes.Add("MimeType");
  15. }
  16. public Artifact GetArtifact(long metadocumentId, long artifactId)
  17. {
  18. return Query(new Paging()).FirstOrDefault(x => x.MetadocumentId == metadocumentId && x.Id== artifactId);
  19. }
  20. public IEnumerable<Artifact> GetArtifacts(long metadocumentId)
  21. {
  22. return Query(new Paging()).Where(x => x.MetadocumentId == metadocumentId);
  23. }
  24. public Artifact GetArtifactByName(long metadocumentId, string nameWithoutExtension, string extension)
  25. {
  26. return Query(new Paging()).FirstOrDefault(x => x.Id == metadocumentId && x.Name.ToLower() == nameWithoutExtension.ToLower() && x.Extension.ToLower() == extension.ToLower());
  27. }
  28. }
  29. }