本文整理汇总了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);
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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();
}
}
示例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);
}
示例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();
}
}
示例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();
}
}