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


C# Repository.Select方法代码示例

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


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

示例1: ReadFrom

 public CommittedEventStream ReadFrom(System.Guid id, long minVersion, long maxVersion)
 {
     var storedEvents = new Repository<StoredEvent>(_session).All()
         .Where(x => x.EventSourceId == id)
         .Where(x => x.EventSequence >= minVersion)
         .Where(x => x.EventSequence <= maxVersion)
         .ToList().OrderBy(x => x.EventSequence);
     return new CommittedEventStream(id, storedEvents.Select(ToComittedEvent));
 }
开发者ID:eddie1459,项目名称:ncqrs,代码行数:9,代码来源:CouchDBEventStore.cs

示例2: GetSector

        /// <summary>
        /// Returns the sector by its Id.
        /// </summary>
        /// <param name="sectorId">Sector Id.</param>
        /// <returns>A sector by its Id.</returns>
        public Sector GetSector(string sectorId)
        {
            Sector ret = null;
            Guid id = Infrastructure.Utilities.Input.GetGuid(sectorId);

            if (id != Guid.Empty)
            {
                using (Repository repo = new Repository())
                    ret = repo.Select<Sector>(id);
            }

            return ret;
        }
开发者ID:volpav,项目名称:toprope,代码行数:18,代码来源:SectorsController.cs

示例3: GetArea

        /// <summary>
        /// Returns the area by its Id.
        /// </summary>
        /// <param name="areaId">Area Id.</param>
        /// <returns>A area by its Id.</returns>
        public Area GetArea(string areaId)
        {
            Area ret = null;
            Guid id = Infrastructure.Utilities.Input.GetGuid(areaId);

            if (id != Guid.Empty)
            {
                using (Repository repo = new Repository())
                    ret = repo.Select<Area>(id);
            }

            return ret;
        }
开发者ID:volpav,项目名称:toprope,代码行数:18,代码来源:AreasController.cs

示例4: CategoryDefinition

        public Definition CategoryDefinition(string name, string description)
        {
            Definition category = _definitions.Value.SingleOrDefault(x => x.Name == name);

            if (category == null)
            {
                var definitionTypes = new Repository<DefinitionType>(_sessionProvider);
                var categoryType = (DefinitionType)EnumerableExtensions.First(definitionTypes.Select());
                category = new Definition { Name = name, Description = description, DefinitionType = categoryType, };
            }
            category.Deleted = false;

            return category;
        }
开发者ID:RagingRudolf,项目名称:uCommerce_migrations,代码行数:14,代码来源:Migrator.cs

示例5: Load

        /// <summary>
        /// Loads model by area Id.
        /// </summary>
        /// <param name="areaId">Area Id.</param>
        /// <returns>View model.</returns>
        public static AreaViewModel Load(Guid areaId)
        {
            Area area = null;
            Route route = null;
            Sector sector = null;
            AreaViewModel ret = null;
            SectorSummary summary = null;
            HashSet<Guid> addedRoutes = null;
            List<SectorSummary> summaries = null;
            IDictionary<Guid, Tuple<Sector, IList<Route>>> sectors = null;

            if (areaId != Guid.Empty)
            {
                ret = new AreaViewModel();
                addedRoutes = new HashSet<Guid>();
                summaries = new List<SectorSummary>();
                sectors = new Dictionary<Guid, Tuple<Sector, IList<Route>>>();

                using (Repository repo = new Repository())
                {
                    using (System.Data.IDataReader reader = repo.Select(SqlBuilder.SelectAll("a.[Id] = @areaId"), new Infrastructure.Storage.Parameter("areaId", areaId)))
                    {
                        while (reader.Read())
                        {
                            if (area == null)
                            {
                                area = Infrastructure.Storage.Repository.Read<Area>(reader, "Area");

                                if (area != null)
                                    area.CopyTo(ret);
                            }

                            sector = Infrastructure.Storage.Repository.Read<Sector>(reader, "Sector");
                            route = Infrastructure.Storage.Repository.Read<Route>(reader, "Route");

                            if (sector != null && sector.Id != Guid.Empty)
                            {
                                if (!sectors.ContainsKey(sector.Id))
                                    sectors.Add(sector.Id, new Tuple<Sector, IList<Route>>(sector, new List<Route>()));

                                if (route != null && route.Id != Guid.Empty && !addedRoutes.Contains(route.Id))
                                {
                                    sectors[sector.Id].Item2.Add(route);
                                    addedRoutes.Add(route.Id);
                                }
                            }
                        }
                    }
                }

                foreach (Tuple<Sector, IList<Route>> s in sectors.Values)
                {
                    summary = new SectorSummary(s.Item1);
                    summary.Routes = s.Item2.OrderBy(r => r.Order).ToList();

                    summaries.Add(summary);
                }

                ret.Sectors = summaries.OrderBy(s => s.Order).ToList();
            }

            return ret;
        }
开发者ID:volpav,项目名称:toprope,代码行数:68,代码来源:AreaViewModel.cs

示例6: CanAddNew

        public void CanAddNew()
        {
            var cn = Maker.CreateContent();
            var repC = new Repository<Content>(Factory);
            using (var t = Session.BeginTransaction())
            {
                repC.Add(cn);
                t.Commit();
            }

            var c2 = repC.Select(c => c.Title == "Title").First();
            Assert.IsNotNull(c2);
        }
开发者ID:flq,项目名称:Rf.Sites,代码行数:13,代码来源:When_repository_is_used.cs

示例7: GetSectorRoutes

        /// <summary>
        /// Returns all routes for a given sector.
        /// </summary>
        /// <param name="sectorId">Sector Id.</param>
        /// <returns>All routes for a given sector.</returns>
        public IEnumerable<Route> GetSectorRoutes(string sectorId)
        {
            Route r = null;
            List<Route> ret = new List<Route>();
            Guid id = Infrastructure.Utilities.Input.GetGuid(sectorId);

            if (id != Guid.Empty)
            {
                using (Repository repo = new Repository())
                {
                    using (System.Data.IDataReader reader = repo.Select(SqlBuilder.Select("Route", "[SectorId] = @id"), new Parameter("id", id)))
                    {
                        while (reader.Read())
                        {
                            r = Repository.Read<Route>(reader);

                            if (r != null && r.Id != Guid.Empty)
                                ret.Add(r);
                        }
                    }
                }
            }

            if (ret.Any())
                ret.Sort((x, y) => { return x.Order - y.Order; });

            return ret;
        }
开发者ID:volpav,项目名称:toprope,代码行数:33,代码来源:SectorsController.cs


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