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


C# IRepository.SingleOrDefault方法代码示例

本文整理汇总了C#中IRepository.SingleOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# IRepository.SingleOrDefault方法的具体用法?C# IRepository.SingleOrDefault怎么用?C# IRepository.SingleOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRepository的用法示例。


在下文中一共展示了IRepository.SingleOrDefault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PSTutorialFlags

        public PSTutorialFlags(account account, IRepository<character_tutorial> characterTutorials)
            : base(WorldOpcodes.SMSG_TUTORIAL_FLAGS)
        {
            character_tutorial characterTutorial = characterTutorials.SingleOrDefault(ct => ct.account == account.id);

            if (characterTutorial == null)
            {
                characterTutorial = new character_tutorial()
                                        {
                                            account = account.id,
                                            tut0 = 0,
                                            tut1 = 0,
                                            tut2 = 0,
                                            tut3 = 0,
                                            tut4 = 0,
                                            tut5 = 0,
                                            tut6 = 0,
                                            tut7 = 0
                                        };
                characterTutorials.Add(characterTutorial);
            }

            this.Write((byte)characterTutorial.tut0);
            this.Write((byte)characterTutorial.tut1);
            this.Write((byte)characterTutorial.tut2);
            this.Write((byte)characterTutorial.tut3);
            this.Write((byte)characterTutorial.tut4);
            this.Write((byte)characterTutorial.tut5);
            this.Write((byte)characterTutorial.tut6);
            this.Write((byte)characterTutorial.tut7);
        }
开发者ID:Refuge89,项目名称:Vanilla,代码行数:31,代码来源:PSTutorialFlags.cs

示例2: Delete

 public void Delete(int id)
 {
     DAL.DataEntities.UITemplate template;
     using (_UITemplateRepository = new GenericRepository<DAL.DataEntities.UITemplate>())
     {
         template = _UITemplateRepository.SingleOrDefault(m => m.ID == id);
         _UITemplateRepository.Delete(template);
         _UITemplateRepository.SaveChanges();
     }
 }
开发者ID:dswingle,项目名称:openconfigurator,代码行数:10,代码来源:UITemplateService.cs

示例3: Delete

 public void Delete(int id)
 {
     DAL.DataEntities.CompositionRule feature;
     using (_CompositionRuleRepository = new GenericRepository<DAL.DataEntities.CompositionRule>())
     {
         feature = _CompositionRuleRepository.SingleOrDefault(m => m.ID == id);
         _CompositionRuleRepository.Delete(feature);
         _CompositionRuleRepository.SaveChanges();
     }
 }
开发者ID:dswingle,项目名称:openconfigurator,代码行数:10,代码来源:CompositionRuleService.cs

示例4: Delete

 public void Delete(int id)
 {
     DAL.DataEntities.Configuration DALConfiguration;
     using (_ConfigurationRepository = new GenericRepository<DAL.DataEntities.Configuration>())
     {
         DALConfiguration = _ConfigurationRepository.SingleOrDefault(m => m.ID == id);
         _ConfigurationRepository.Delete(DALConfiguration);
         _ConfigurationRepository.SaveChanges();
     }
 }
开发者ID:dswingle,项目名称:openconfigurator,代码行数:10,代码来源:ConfigurationService.cs

示例5: Delete

 public void Delete(int id)
 {
     DAL.DataEntities.Attribute attribute;
     using (_AttributeRepository = new GenericRepository<DAL.DataEntities.Attribute>())
     {
         attribute = _AttributeRepository.SingleOrDefault(m => m.ID == id);
         _AttributeRepository.Delete(attribute);
         _AttributeRepository.SaveChanges();
     }
 }
开发者ID:dswingle,项目名称:openconfigurator,代码行数:10,代码来源:AttributeService.cs

示例6: Delete

 public void Delete(int id)
 {
     DAL.DataEntities.CustomRule customRule;
     using (_CustomRuleRepository = new GenericRepository<DAL.DataEntities.CustomRule>())
     {
         customRule = _CustomRuleRepository.SingleOrDefault(m => m.ID == id);
         _CustomRuleRepository.Delete(customRule);
         _CustomRuleRepository.SaveChanges();
     }
 }
开发者ID:dswingle,项目名称:openconfigurator,代码行数:10,代码来源:CustomRuleService.cs

示例7: Delete

 public void Delete(int id)
 {
     DAL.DataEntities.Model model;
     using (_ModelRepository = new GenericRepository<DAL.DataEntities.Model>())
     {
         model = _ModelRepository.SingleOrDefault(m => m.ID == id);
         _ModelRepository.Delete(model);
         _ModelRepository.SaveChanges();
     }
 }
开发者ID:dswingle,项目名称:openconfigurator,代码行数:10,代码来源:ModelService.cs

示例8: GetByEmailAndPassword

 //Methods
 public BLL.BusinessObjects.User GetByEmailAndPassword(string email, string password)
 {
     DAL.DataEntities.User user;
     using (_UserRepository = new GenericRepository<DAL.DataEntities.User>())
     {
         user = _UserRepository.SingleOrDefault(u =>
             u.Email.Equals(email, StringComparison.InvariantCultureIgnoreCase) && u.Password.Equals(password, StringComparison.InvariantCultureIgnoreCase));
     }
     //
     if (user != null)
         return (BLL.BusinessObjects.User)BLL.BusinessObjects.User.CreateInstance(user);
     else
         return null;
 }
开发者ID:dswingle,项目名称:openconfigurator,代码行数:15,代码来源:UserService.cs

示例9: GetByID

 public BusinessObjects.Configuration GetByID(int id)
 {
     BLL.BusinessObjects.Configuration BLLConfiguration;
     using (_ConfigurationRepository = new GenericRepository<DAL.DataEntities.Configuration>())
     {
         DAL.DataEntities.Configuration DALConfiguration = _ConfigurationRepository.SingleOrDefault(m => m.ID == id);
         BLLConfiguration = BLL.BusinessObjects.Configuration.CreateInstance(DALConfiguration);
     }
     //
     return BLLConfiguration;
 }
开发者ID:dswingle,项目名称:openconfigurator,代码行数:11,代码来源:ConfigurationService.cs

示例10: GetByID

 public BusinessObjects.Attribute GetByID(int id)
 {
     DAL.DataEntities.Attribute attribute;
     using (_AttributeRepository = new GenericRepository<DAL.DataEntities.Attribute>())
     {
         attribute = _AttributeRepository.SingleOrDefault(m => m.ID == id);
     }
     //
     return new BLL.BusinessObjects.Attribute(attribute);
 }
开发者ID:dswingle,项目名称:openconfigurator,代码行数:10,代码来源:AttributeService.cs

示例11: GetByID

 public BusinessObjects.CustomRule GetByID(int id)
 {
     DAL.DataEntities.CustomRule customRule;
     using (_CustomRuleRepository = new GenericRepository<DAL.DataEntities.CustomRule>())
     {
         customRule = _CustomRuleRepository.SingleOrDefault(m => m.ID == id);
     }
     //
     return new BLL.BusinessObjects.CustomRule(customRule);
 }
开发者ID:dswingle,项目名称:openconfigurator,代码行数:10,代码来源:CustomRuleService.cs

示例12: Delete

 public void Delete(int id)
 {
     DAL.DataEntities.Relation relation;
     using (_RelationRepository = new GenericRepository<DAL.DataEntities.Relation>())
     {
         relation = _RelationRepository.SingleOrDefault(m => m.ID == id);
         _RelationRepository.Delete(relation);
         _RelationRepository.SaveChanges();
     }
 }
开发者ID:dswingle,项目名称:openconfigurator,代码行数:10,代码来源:RelationService.cs

示例13: GetByID

 public BusinessObjects.Relation GetByID(int id)
 {
     DAL.DataEntities.Relation relation;
     using (_RelationRepository = new GenericRepository<DAL.DataEntities.Relation>())
     {
         relation = _RelationRepository.SingleOrDefault(r => r.ID == id);
     }
     //
     return new BLL.BusinessObjects.Relation(relation);
 }
开发者ID:dswingle,项目名称:openconfigurator,代码行数:10,代码来源:RelationService.cs

示例14: Delete

        public void Delete(int id)
        {
            DAL.DataEntities.Feature feature;
            using (_FeatureRepository = new GenericRepository<DAL.DataEntities.Feature>())
            {
                feature = _FeatureRepository.SingleOrDefault(m => m.ID == id);

                //Cascade delete on all related FeatureSelections
                using (_FeatureSelectionRepository = new GenericRepository<DAL.DataEntities.FeatureSelection>())
                {
                    IEnumerable<DAL.DataEntities.FeatureSelection> featureSelections = _FeatureSelectionRepository.Find(k => k.FeatureID == feature.ID);
                    foreach (DAL.DataEntities.FeatureSelection featureSelection in featureSelections)
                    {
                        _FeatureSelectionRepository.Delete(featureSelection);
                    }

                    _FeatureSelectionRepository.SaveChanges();
                }

                //
                _FeatureRepository.Delete(feature);
                _FeatureRepository.SaveChanges();
            }
        }
开发者ID:dswingle,项目名称:openconfigurator,代码行数:24,代码来源:FeatureService.cs

示例15: Delete

 public void Delete(int id)
 {
     DAL.DataEntities.FeatureSelection feature;
     using (_FeatureSelectionRepository = new GenericRepository<DAL.DataEntities.FeatureSelection>())
     {
         feature = _FeatureSelectionRepository.SingleOrDefault(m => m.ID == id);
         _FeatureSelectionRepository.Delete(feature);
         _FeatureSelectionRepository.SaveChanges();
     }
 }
开发者ID:dswingle,项目名称:openconfigurator,代码行数:10,代码来源:FeatureSelectionService.cs


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