本文整理汇总了C#中GLyra.Dota2.Repositories.Dota2Entities类的典型用法代码示例。如果您正苦于以下问题:C# Dota2Entities类的具体用法?C# Dota2Entities怎么用?C# Dota2Entities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dota2Entities类属于GLyra.Dota2.Repositories命名空间,在下文中一共展示了Dota2Entities类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: checkIfSkillNameExists
/// <summary>
/// Checks if the description of the skill exists
/// </summary>
protected SkillEffectName checkIfSkillNameExists(string name, string heroName, string skillName)
{
SkillEffectName skillEffectName = new SkillEffectName();
using (Dota2Entities ctx = new Dota2Entities())
{
//get SkillId
SkillCreator.SelectByName(skillName)
if (skill != null)
{
try
{
if (ctx.SkillEffectName.Any(x =>
x.Name == name &&
x.Skill.Hero.Name == heroName))
{
Console.WriteLine("Skill " + name + " Already exists...");
return true;
}
else
{
return null;
}
}
catch (Exception e)
{
//TODO implementar log de erro
throw e;
}
}
}
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:36,代码来源:1392757197$SkillEffectNameCreator.cs
示例2: insertSkillEffectName
public SkillEffectName insertSkillEffectName(string name, string heroName, string skillName,
List<string> skillEffectValues, string skillDescription)
{
SkillEffectName skillEffectName = new SkillEffectName();
Skill skill = SkillCreator.SelectByName(skillName);
skillEffectName.Name = name.Trim();
skillEffectName = checkIfSkillNameExists(name, skill, skillDescription);
if (skillEffectName == null)
{
using (Dota2Entities ctx = new Dota2Entities())
{
try
{
skillEffectName = ctx.SkillEffectName.Add(skillEffectName);
ctx.SaveChanges();
Console.WriteLine("Skill " + name + " Created");
}
catch (Exception e)
{
throw e;
}
}
}
return skillEffectName;
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:31,代码来源:1392758075$SkillEffectNameCreator.cs
示例3: AttributesCreator
public AttributesCreator(int heroId, Dictionary<string, string> primaryStats)
{
attribute = new Attributes();
attribute.HeroId = heroId;
attribute.Intelligence = primaryStats["Intelligence"];
attribute.Agility = primaryStats["Agility"];
attribute.Strength = primaryStats["Strength"];
attribute.Damage = primaryStats["Damage"];
attribute.MoveSpeed = primaryStats["Movespeed"];
attribute.Armor = primaryStats["Armor"];
using (Dota2Entities ctx = new Dota2Entities())
{
try
{
ctx.Attributes.Add(this.attribute);
ctx.SaveChanges();
Console.WriteLine("Primary Stats Created ");
}
catch (Exception e)
{
//TODO Adicionar ao log
throw e;
}
}
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:27,代码来源:AttributesCreator.cs
示例4: InsertSkillImage
public SkillImage InsertSkillImage(int skillId, string imageUrl)
{
SkillImage skillImage = new SkillImage();
try
{
using (Dota2Entities ctx = new Dota2Entities())
{
//Check if the image exists
if (!ctx.SkillImage.Any(si => si.Url == imageUrl))
{
skillImage.SkillId = skillId;
skillImage.Url = imageUrl;
ctx.SkillImage.Add(skillImage);
ctx.SaveChanges();
}
else
{
skillImage = ctx.SkillImage.Where(si => si.Url == imageUrl).FirstOrDefault();
Console.WriteLine("SkillImage Already exists");
}
}
}
catch (Exception)
{
//TODO implementar log
throw;
}
return skillImage;
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:32,代码来源:1393450980$SkillImageCreator.cs
示例5: checkIfSkillNameExists
/// <summary>
/// Checks if the description of the skill exists
/// </summary>
protected SkillEffectName checkIfSkillNameExists(string name, Skill skill, string skillDescription)
{
SkillEffectName skillEffectName = new SkillEffectName();
using (Dota2Entities ctx = new Dota2Entities())
{
try
{
ctx.Configuration.LazyLoadingEnabled = true;
if(ctx.SkillEffectName.Any(s => s.Name == name))
{
skillEffectName = ctx.SkillEffectName.Where(x =>
x.Name == name).First();
skillEffectName = ctx.SkillEffectName.Where(x =>
x.Name == name &&
x.Skill.Hero.Name == skill.Hero.Name &&
skillDescription == skill.Description).First();
Console.WriteLine("Skill " + name + " Already exists...");
return skillEffectName;
}
else
{
return null;
}
}
catch (Exception e)
{
//TODO implementar log de erro
throw e;
}
}
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:38,代码来源:1392924794$SkillEffectNameCreator.cs
示例6: createHero
public Hero createHero(string heroName, string biography)
{
this.hero = new Hero();
this.hero.Name = heroName;
this.hero.Biography = biography;
using (Dota2Entities ctx = new Dota2Entities())
{
try
{
ctx.Hero.Add(this.hero);
ctx.SaveChanges();
Console.WriteLine("*************************** " + heroName + " Created(Hero)" + "***************************");
}
catch (Exception e)
{
//TODO Adicionar ao log
throw e;
}
}
return this.hero;
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:25,代码来源:1393440368$HeroCreator.cs
示例7: InsertSkillEffectName
public SkillEffectName InsertSkillEffectName(string name, string heroName, Skill skill, List<string> skillEffectValues)
{
SkillEffectName skillEffectName;
Skill completeSkill = SkillCreator.SelectByName(skill.Name);
bool exists = checkIfSkillNameExists(name, completeSkill, completeSkill.Description, out skillEffectName);
if (!exists)
{
skillEffectName.Name = name.Trim();
skillEffectName.SkillId = completeSkill.ID;
skillEffectName.ValueLv1 = int.Parse(skillEffectValues.First());
skillEffectName.ValueLv2 = int.Parse(skillEffectValues.ElementAt(1));
skillEffectName.ValueLv3 = int.Parse(skillEffectValues.ElementAt(2));
skillEffectName.ValueLv4 = int.Parse(skillEffectValues.ElementAt(3));
skillEffectName.ValueScepter = int.Parse(skillEffectValues.Last());
using (Dota2Entities ctx = new Dota2Entities())
{
try
{
skillEffectName = ctx.SkillEffectName.Add(skillEffectName);
ctx.SaveChanges();
Console.WriteLine("Skill " + name + " Created");
}
catch (Exception e)
{
throw e;
}
}
}
return skillEffectName;
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:34,代码来源:1392929019$SkillEffectNameCreator.cs
示例8: checkIfSkillNameExists
/// <summary>
/// Checks if the description of the skill exists
/// </summary>
protected SkillEffectName checkIfSkillNameExists(string name, string heroName, string skillId)
{
SkillEffectName skillEffectName = new SkillEffectName();
using(Dota2Entities ctx = new Dota2Entities())
{
//get SkillId
//if (skill != null)
//{
// try
// {
// if (ctx.SkillEffectName.Any(x =>
// x.Name == name &&
// x.Skill.Hero.Name == heroName))
// {
// Console.WriteLine("Skill " + name + " Already exists...");
// return true;
// }
// else
// {
// return null;
// }
// }
// catch (Exception e)
// {
// //TODO implementar log de erro
// throw e;
// }
//}
}
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:36,代码来源:1392756235$SkillEffectNameCreator.cs
示例9: InsertHeroPortrait
public HeroPortrait InsertHeroPortrait(int heroId, string imageUrl)
{
HeroPortrait HeroPortrait = new HeroPortrait();
try
{
using (Dota2Entities ctx = new Dota2Entities())
{
//Check if the image exists
if (!ctx.HeroPortrait.Any(si => si.Url == imageUrl))
{
HeroPortrait.HeroId = heroId;
HeroPortrait.Url = imageUrl;
ctx.HeroPortrait.Add(HeroPortrait);
ctx.SaveChanges();
Console.WriteLine("Image " + HeroPortrait.Url + " Added");
}
else
{
HeroPortrait = ctx.HeroPortrait.Where(si => si.Url == imageUrl).FirstOrDefault();
Console.WriteLine("HeroPortrait Already exists");
}
}
}
catch (Exception)
{
//TODO implementar log
throw;
}
return HeroPortrait;
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:33,代码来源:HeroPortraitCreator.cs
示例10: createHero
public Hero createHero(string name, List<string> primaryStats, string biography)
{
this.hero = new Hero();
this.hero.Name = name;
this.hero.Biography = biography;
using (Dota2Entities ctx = new Dota2Entities())
{
try
{
ctx.Hero.Add(this.hero);
ctx.SaveChanges();
}
catch(Exception e)
{
//TODO Adicionar ao log
throw e.Message;
}
return this.hero;
}
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:26,代码来源:1392058036$HeroCreator.cs
示例11: checkIfSkillNameExists
/// <summary>
/// Checks if the description of the skill exists
/// </summary>
protected SkillEffectName checkIfSkillNameExists(string name, Skill skill, string skillDescription)
{
SkillEffectName skillEffectName = new SkillEffectName();
using (Dota2Entities ctx = new Dota2Entities())
{
try
{
skillEffectName = ctx.SkillEffectName.Where(x =>
x.Name == name &&
x.Skill.Hero.Name == skill.Hero.Name &&
skillDescription == skill.Description).First();
if(skillEffectName.ID != null)
{
Console.WriteLine("Skill " + name + " Already exists...");
return skillEffectName;
}
else
{
return null;
}
}
catch (Exception e)
{
//TODO implementar log de erro
throw e;
}
}
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:31,代码来源:1392758075$SkillEffectNameCreator.cs
示例12: insert
public SkillAbilityTypes insert(int skillId, int abilityTypeId, out bool success)
{
skillAbilityType = new SkillAbilityTypes();
using (Dota2Entities ctx = new Dota2Entities())
{
try
{
skillAbilityType.SkillId = skillId;
skillAbilityType.AbilityTypeId = abilityTypeId;
ctx.SkillAbilityTypes.Add(skillAbilityType);
ctx.SaveChanges();
success = true;
}
catch (Exception e)
{
success = false;
throw e;
}
}
return skillAbilityType;
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:25,代码来源:1392142967$SkillAbilityTypeCreator.cs
示例13: checkIfSkillNameExists
/// <summary>
/// Checks if the description of the skill exists, in negative case call the insertSkillDesc
/// </summary>
public SkillEffectName checkIfSkillNameExists(string name)
{
SkillEffectName skillEffectName = new SkillEffectName();
using(Dota2Entities ctx = new Dota2Entities())
{
try
{
if (ctx.SkillEffectName.Any(x => x.Name == name))
{
Console.WriteLine("Skill " + name + " Already exists...");
}
else
{
skillEffectName = insertSkillEffectName(name);
}
}
catch (Exception e)
{
//TODO implementar log de erro
throw e;
}
}
return skillEffectName;
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:28,代码来源:1392756210$SkillEffectNameCreator.cs
示例14: setAbilityCastType
void setAbilityCastType(string abilityCastTypeString)
{
using(Dota2Entities ctx = new Dota2Entities())
{
var abilityType = (from e in ctx.AbilityType
where e.Name == abilityCastTypeString);
}
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:9,代码来源:1392052378$SkillCreator.cs
示例15: getHeroByName
public Hero getHeroByName(string heroName)
{
Hero hero = new Hero();
using (Dota2Entities ctx = new Dota2Entities())
{
hero = ctx.Hero.Where(h => h.Name == heroName).FirstOrDefault();
}
return hero;
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:10,代码来源:HeroCreator.cs
示例16: setAbilityCastType
void setAbilityCastType(string abilityCastTypeString)
{
AbilityType abilityType = new AbilityType();
using(Dota2Entities ctx = new Dota2Entities())
{
var abType = (from p in ctx.AbilityType
where p.Name == abilityCastTypeString
select p);
}
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:12,代码来源:1392052690$SkillCreator.cs
示例17: setAbilityCastType
void setAbilityCastType(string abilityCastTypeString)
{
AbilityType abilityType = new AbilityType();
using(Dota2Entities ctx = new Dota2Entities())
{
var abilityTp = (from p in ctx.AbilityType
where p.Name == abilityCastTypeString
select p).FirstOrDefault();
abilityType = abilityTp;
}
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:12,代码来源:1392052745$SkillCreator.cs
示例18: setAbilityCastType
void setAbilityCastType(string abilityCastTypeString)
{
using(Dota2Entities ctx = new Dota2Entities())
{
var abilityType = (from p in contextDb.PassBook
where p.Locator == passBook.Locator
where p.PassagerName == passBook.PassagerName
where p.FlightData == passBook.FlightData
where p.FlightNumber == passBook.FlightNumber
where p.DepartureAirportName == passBook.DepartureAirportName
select p).FirstOrDefault();
}
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:14,代码来源:1392052443$SkillCreator.cs
示例19: insert
public SkillAbilityTypes insert(int skillId, int abilityTypeId, Dota2Entities ctx)
{
SkillAbilityTypes skillAbilityType = new SkillAbilityTypes();
try
{
skillAbilityType.SkillId = skillId;
skillAbilityType.AbilityTypeId = abilityTypeId;
ctx.SkillAbilityTypes.Add(skillAbilityType);
}
catch (Exception e)
{
throw e;
}
return skillAbilityType;
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:18,代码来源:1392137138$SkillAbilityTypeCreator.cs
示例20: setAbilityCastType
void setAbilityCastType(string abilityCastTypeString)
{
AbilityType abilityType = new AbilityType();
using(Dota2Entities ctx = new Dota2Entities())
{
var abilityTp = (from p in ctx.AbilityType
where p.Name == abilityCastTypeString
select p).FirstOrDefault();
abilityType = abilityTp;
}
if (abilityType != null)
this.skill.AbilityType = abilityType;
else
{
//TODO Incluir este erro no log posteriormente
throw new Exception("No AbilityType has been returned. AbilityType: " + abilityCastTypeString);
}
}
开发者ID:GibranLyra,项目名称:GLyra.Dota2Project,代码行数:20,代码来源:1392053236$SkillCreator.cs
注:本文中的GLyra.Dota2.Repositories.Dota2Entities类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论