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


C# IProcessQueries.Execute方法代码示例

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


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

示例1: ApplySecurity

        internal static void ApplySecurity(this Agreement agreement, IPrincipal principal, IProcessQueries queryProcessor)
        {
            if (agreement == null) return;
            if (principal == null) throw new ArgumentNullException("principal");
            if (queryProcessor == null) throw new ArgumentNullException("queryProcessor");

            var ownedTenantIds = queryProcessor.Execute(new MyOwnedTenantIds(principal));
            agreement.ApplySecurity(principal, ownedTenantIds);
        }
开发者ID:ucosmic,项目名称:UCosmicAlpha,代码行数:9,代码来源:SecureAgreements.cs

示例2: OwnedBy

        internal static IQueryable<Agreement> OwnedBy(this IQueryable<Agreement> agreements, IPrincipal principal, IProcessQueries queryProcessor)
        {
            if (agreements == null) return null;
            if (principal == null) throw new ArgumentNullException("principal");
            if (queryProcessor == null) throw new ArgumentNullException("queryProcessor");

            var ownedTenantIds = queryProcessor.Execute(new MyOwnedTenantIds(principal));
            return agreements.OwnedBy(principal, ownedTenantIds);
        }
开发者ID:ucosmic,项目名称:UCosmicAlpha,代码行数:9,代码来源:QueryAgreements.cs

示例3: NameMatchesEntity

        public static bool NameMatchesEntity(string name, IProcessQueries queryProcessor,
            IEnumerable<Expression<Func<User, object>>> eagerLoad, out User entity)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                entity = null;
                return false;
            }

            entity = queryProcessor.Execute(
                new GetUserByNameQuery
                {
                    Name = name,
                    EagerLoad = eagerLoad,
                }
            );

            // return true (valid) if there is an entity
            return entity != null;
        }
开发者ID:danludwig,项目名称:UCosmic,代码行数:20,代码来源:ValidateUser.cs

示例4: ClientCookie

        public static void ClientCookie(this HttpResponseBase response, string userId, IProcessQueries queries)
        {
            if (response == null) throw new ArgumentNullException("response");
            if (queries == null) throw new ArgumentNullException("queries");

            var cookie = new HttpCookie(CookieName, "");

            int userIdInt;
            if (int.TryParse(userId, out userIdInt))
            {
                var data = queries.Execute(new ClientCookieBy(userIdInt)).Result;
                var json = JsonConvert.SerializeObject(data);
                byte[] jsonBytes = MachineKey.Protect(Encoding.UTF8.GetBytes(json), "Cookie");
                string cookieValue = HttpServerUtility.UrlTokenEncode(jsonBytes);
                cookie.Values[ClientCookieKey] = cookieValue;
                //cookie.Expires = DateTime.UtcNow.AddDays(60);
            }
            else
            {
                cookie.Expires = DateTime.UtcNow.AddDays(-2);
            }

            response.SetCookie(cookie);
        }
开发者ID:phobos04,项目名称:tripod,代码行数:24,代码来源:CookieExtensions.cs

示例5: Build

        private void Build(int retryCount)
        {
            _queryProcessor = ServiceProviderLocator.Current.GetService<IProcessQueries>();
            _updateEstablishment = ServiceProviderLocator.Current.GetService<IHandleCommands<UpdateEstablishment>>();
            _unitOfWork = ServiceProviderLocator.Current.GetService<IUnitOfWork>();
            _placeFinder = ServiceProviderLocator.Current.GetService<IConsumePlaceFinder>();
            try
            {
                var establishment = _queryProcessor.Execute(new GetEstablishmentByIdQuery(_establishmentId));
                if (!establishment.Location.Center.HasValue) return;

                var latitude = establishment.Location.Center.Latitude;
                var longitude = establishment.Location.Center.Longitude;
                if (!latitude.HasValue || !longitude.HasValue) return;

                var result = _placeFinder.Find(new PlaceByCoordinates(latitude.Value, longitude.Value)).SingleOrDefault();
                if (result == null) return;
                if (!result.WoeId.HasValue)
                {
                    throw new NotSupportedException(string.Format(
                        "Could not find WOE ID for coordinates {0},{1}", latitude, longitude));
                }
                //var place = _placeFactory.FromWoeId(result.WoeId.Value);
                var place = _queryProcessor.Execute(
                    new GetPlaceByWoeIdQuery
                    {
                        WoeId = result.WoeId.Value,
                    });
                var places = place.Ancestors.OrderByDescending(n => n.Separation).Select(a => a.Ancestor).ToList();
                places.Add(place);
                var command = new UpdateEstablishment
                {
                    Id = establishment.RevisionId,
                    PlaceIds = places.Select(p => p.RevisionId).ToArray(),
                };
                _updateEstablishment.Handle(command);
                //_establishment.Location.Places.Clear();
                //_establishment.Location.Places = places;
                //_objectCommander.Update(_establishment, true);
                //_entities.Update(_establishment);
                _unitOfWork.SaveChanges();
            }
            catch (Exception ex)
            {
                var exceptionLogger = ServiceProviderLocator.Current.GetService<ILogExceptions>();
                exceptionLogger.LogException(ex);

                if (ex is NotSupportedException)
                {
                    retryCount = 3;
                }

                if (retryCount < 2)
                {
                    Build(++retryCount);
                }
            }
        }
开发者ID:danludwig,项目名称:UCosmic,代码行数:58,代码来源:SupplementalFormsController.cs

示例6: WorkCopy

 internal static bool WorkCopy(int activityId, IProcessQueries queryProcessor)
 {
     var activity = queryProcessor.Execute(new ActivityById(activityId));
     return activity != null && activity.Original != null;
 }
开发者ID:ucosmic,项目名称:UCosmicAlpha,代码行数:5,代码来源:IsActivity.cs


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