/
VideoDao.cs
40 lines (32 loc) · 910 Bytes
/
VideoDao.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using NHibernate;
using NHibernate.Criterion;
using System.Collections.Generic;
using Streamus_Web_API.Domain;
using Streamus_Web_API.Domain.Interfaces;
namespace Streamus_Web_API.Dao
{
public class VideoDao : AbstractNHibernateDao<Video>, IVideoDao
{
public VideoDao(ISession session)
: base(session)
{
}
public Video Get(string id)
{
Video video = null;
if (id != default(string))
{
video = Session.Load<Video>(id);
}
return video;
}
public IList<Video> Get(List<string> ids)
{
IQueryOver<Video, Video> criteria = Session
.QueryOver<Video>()
.Where(video => video.Id.IsIn(ids));
IList<Video> videos = criteria.List<Video>();
return videos;
}
}
}