本文整理汇总了C#中Repository.Where方法的典型用法代码示例。如果您正苦于以下问题:C# Repository.Where方法的具体用法?C# Repository.Where怎么用?C# Repository.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Repository
的用法示例。
在下文中一共展示了Repository.Where方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetByForeignId
public void GetByForeignId()
{
var session = GetConnection().CreateSession(_DatabaseName);
var repository = new Repository<ProductTranslation>(session);
var translation = repository.Where(t => t.ForeignId).Eq(1).First();
Console.WriteLine(translation);
}
示例2: Aktualizuj
public VysledekOperace Aktualizuj(Registracka hrac)
{
using (var session = _store.CreateSession(_jmenoDatabaze))
{
var hledac = new Repository<Registracka>(session);
var kAktualizaci = hledac.Where(r => r.Email).Eq(hrac.Email).FirstOrDefault();
if (kAktualizaci == null)
return VysledekOperace.HracNenalezen(hrac.Email);
kAktualizaci.Jmeno = hrac.Jmeno;
kAktualizaci.Prijmeni = hrac.Prijmeni;
kAktualizaci.Prezdivka = hrac.Prezdivka;
session.Save(hrac);
}
return VysledekOperace.Hotovo;
}
示例3: Contact
public ActionResult Contact(int id)
{
var listOfLocations = new Repository<Location>().FindAll().ToList();
var location = listOfLocations.Where(l => l.ID == id).ToList();
return View(location);
}
示例4: should_persist_Audit_Role
public void should_persist_Audit_Role()
{
var auditRepo = new Repository<AuditLog>(Session);
var roleId = Guid.Parse("7C270960-0C16-4812-9CEF-275EA308A1AD");
// create the role
Session.BeginTransaction();
var roleRepo = new Repository<Role>(Session);
var role = new Role("TestRole " + roleId) {Id = roleId};
roleRepo.SaveOrUpdate(role);
Session.Transaction.Commit();
Session.Evict(role);
// assert exists in the audit log
var exists = auditRepo.Where(a => a.RecordId == roleId && a.CommitVersion.Value == 1 && a.EventType == "A" && a.EntityName == "Role");
//Assert.True(exists.Any());
// Update
Session = null;
Session = Container.Resolve<ISessionFactory>().OpenSession();
// fine the role and modify the role
Session.BeginTransaction();
roleRepo = new Repository<Role>(Session);
role = roleRepo.Get(roleId);
role.UpdateValue("TestRoleX");
Session.Transaction.Commit();
Session.Evict(role);
auditRepo = new Repository<AuditLog>(Session);
exists = auditRepo.Where(a => a.RecordId == roleId && a.CommitVersion.Value == 2 && a.EventType == "M" && a.EntityName == "Role");
//Assert.True(exists.Any());
// delete
Session = null;
Session = Container.Resolve<ISessionFactory>().OpenSession();
roleRepo = new Repository<Role>(Session);
role = roleRepo.Get(roleId);
Session.BeginTransaction();
roleRepo.Delete(role);
Session.Transaction.Commit();
auditRepo = new Repository<AuditLog>(Session);
exists = auditRepo.Where(a => a.RecordId == roleId && a.CommitVersion.Value == 3 && a.EventType == "D" && a.EntityName == "Role");
}
示例5: SoupiskaPodle
public SoupiskaZapasu SoupiskaPodle(DateTime datum)
{
using (var session = _store.CreateSession(_jmenoDatabaze))
{
var r = new Repository<SoupiskaZapasu>(session);
var soupiska = r.Where(s => s.Datum).Eq(datum.Date).FirstOrDefault();
return soupiska;
}
}
示例6: SmazHrace
public VysledekOperace SmazHrace(string email)
{
using (var session = _store.CreateSession(_jmenoDatabaze))
{
var hledac = new Repository<Registracka>(session);
var hrac = hledac.Where(r => r.Email).Eq(email).FirstOrDefault();
if (hrac == null)
return VysledekOperace.HracNenalezen(email);
session.Delete(hrac);
}
return VysledekOperace.Hotovo;
}
示例7: DejMiHrace
public Registracka DejMiHrace(string email)
{
using (var session = _store.CreateSession(_jmenoDatabaze))
{
var hledac = new Repository<Registracka>(session);
return hledac.Where(r => r.Email).Eq(email).FirstOrDefault();
}
}