本文整理汇总了C#中RepositoryFactory.GetAll方法的典型用法代码示例。如果您正苦于以下问题:C# RepositoryFactory.GetAll方法的具体用法?C# RepositoryFactory.GetAll怎么用?C# RepositoryFactory.GetAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RepositoryFactory
的用法示例。
在下文中一共展示了RepositoryFactory.GetAll方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public IEnumerable<Team> Create(Game game, int howMany)
{
var teams = new List<Team>();
using (var formationRepository = new RepositoryFactory().CreateFormationRepository())
{
var formations = formationRepository.GetAll();
bool teamGenerationReady = false;
while (!teamGenerationReady)
{
var team = _teamGenerator.Generate();
// Team names must be unique.
bool teamExists = teams.Any(t => t.Name == team.Name);
if (!teamExists)
{
team.Game = game;
team.Formation = _listRandomizer.GetItem(formations);
teams.Add(team);
}
teamGenerationReady = (teams.Count == howMany);
}
}
return teams;
}
示例2: GetAll
public IEnumerable<Line> GetAll()
{
using (var lineRepository = new RepositoryFactory().CreateLineRepository())
{
var lines = lineRepository.GetAll();
return lines;
}
}
示例3: GetAll
public IEnumerable<Position> GetAll()
{
using (var positionRepository = new RepositoryFactory().CreatePositionRepository())
{
var positions = positionRepository.GetAll();
return positions;
}
}
示例4: GetAll
public IEnumerable<Competition> GetAll()
{
using (var competitionRepository = new RepositoryFactory().CreateCompetitionRepository())
{
var competitions = competitionRepository.GetAll();
return competitions;
}
}
示例5: PickRandom
/// <summary>
/// Picks a random <see cref="PlayerProfile"/>.
/// </summary>
public PlayerProfile PickRandom()
{
using (var playerProfileRepository = new RepositoryFactory().CreatePlayerProfileRepository())
{
var playerProfiles = playerProfileRepository.GetAll();
var pickedPlayerProfile = GetRandomPlayerProfile(playerProfiles);
return pickedPlayerProfile;
}
}
示例6: PlayerGenerator
internal PlayerGenerator()
{
_personNameGenerator = new PersonNameGenerator();
_profileScoreCalculator = new ProfileScoreCalculator();
_numberRandomizer = new NumberRandomizer();
_listRandomizer = new ListRandomizer();
_positionDeterminator = new PositionDeterminator();
using (var lineRepository = new RepositoryFactory().CreateLineRepository())
{
_lines = lineRepository.GetAll();
}
using (var positionRepository = new RepositoryFactory().CreatePositionRepository())
{
_positions = positionRepository.GetAll();
}
using (var playerProfileRepository = new RepositoryFactory().CreatePlayerProfileRepository())
{
_playerProfiles = playerProfileRepository.GetAll();
}
}