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


C# RepositoryFactory.GetAll方法代码示例

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

示例2: GetAll

 public IEnumerable<Line> GetAll()
 {
     using (var lineRepository = new RepositoryFactory().CreateLineRepository())
      {
     var lines = lineRepository.GetAll();
     return lines;
      }
 }
开发者ID:bouwe77,项目名称:fmg,代码行数:8,代码来源:LineService.cs

示例3: GetAll

 public IEnumerable<Position> GetAll()
 {
     using (var positionRepository = new RepositoryFactory().CreatePositionRepository())
      {
     var positions = positionRepository.GetAll();
     return positions;
      }
 }
开发者ID:bouwe77,项目名称:fmg,代码行数:8,代码来源:PositionService.cs

示例4: GetAll

 public IEnumerable<Competition> GetAll()
 {
     using (var competitionRepository = new RepositoryFactory().CreateCompetitionRepository())
      {
     var competitions = competitionRepository.GetAll();
     return competitions;
      }
 }
开发者ID:bouwe77,项目名称:fmg,代码行数:8,代码来源:CompetitionService.cs

示例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;
             }
        }
开发者ID:bouwe77,项目名称:fmg,代码行数:13,代码来源:PlayerProfileService.cs

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


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