当前位置: 首页>>代码示例>>C#>>正文


C# Repository.Where方法代码示例

本文整理汇总了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);
 }
开发者ID:g0t4,项目名称:Presentations,代码行数:7,代码来源:Demos.cs

示例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;
        }
开发者ID:rosic,项目名称:Soupiska,代码行数:18,代码来源:CouchRepositar.cs

示例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);
        }
开发者ID:gustavarrhenius,项目名称:Varldsklass,代码行数:8,代码来源:HomeController.cs

示例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");
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:66,代码来源:when_persisting_audit_log.cs

示例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;
     }
 }
开发者ID:rosic,项目名称:Soupiska,代码行数:9,代码来源:CouchRepositar.cs

示例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;
        }
开发者ID:rosic,项目名称:Soupiska,代码行数:14,代码来源:CouchRepositar.cs

示例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();
     }
 }
开发者ID:rosic,项目名称:Soupiska,代码行数:8,代码来源:CouchRepositar.cs


注:本文中的Repository.Where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。