• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IOperationContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IOperationContext的典型用法代码示例。如果您正苦于以下问题:C# IOperationContext类的具体用法?C# IOperationContext怎么用?C# IOperationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IOperationContext类属于命名空间,在下文中一共展示了IOperationContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Process

        async Task<OperationResult> Process(TestStatelessUnreliable msg, IOperationContext arg2)
        {
            if (msg.SleepDurationMs > 0)
                await Task.Delay(msg.SleepDurationMs);

            return OperationResult.Success;
        }
开发者ID:Rurouni,项目名称:MassiveOnlineUniversalServerEngine,代码行数:7,代码来源:TestActor.cs


示例2: ConfigureOperationContext

 /// <summary>
 /// Prepare the given OperationContext for use with this CMIS profile.
 /// </summary>
 /// <param name="operationContext"></param>
 public void ConfigureOperationContext(IOperationContext operationContext)
 {
     /*
     Disabled because repository may generate error if the type is not Orderable for cmis:contentStreamFileName
     Documentum generates such an error: https://github.com/aegif/CmisSync/issues/724
     Alfresco also is not Orderable even though it does not generate an error:
     http://stackoverflow.com/questions/39290294/check-whether-cmiscontentstreamfilename-is-orderable
     
     if (IgnoreIfSameLowercaseNames)
     {
         // Depending on the CMIS profile, order by stream name or document name.
         if (UseCmisStreamName && contentStreamFileNameOrderable)
         {
             operationContext.OrderBy = "cmis:contentStreamFileName";
         }
         else
         {
             operationContext.OrderBy = "cmis:name";
         }
     }
     else
     {
         // Do not specify an order criteria, as we don't need it,
         // and it might have a performance impact on the CMIS server.
     }
     */
 }
开发者ID:aegif,项目名称:CmisSync,代码行数:31,代码来源:CmisProfile.cs


示例3: Process

 public void Process(SayS2S msg, IOperationContext context)
 {
     foreach (var roomMember in _roomMembers)
     {
         roomMember.CallbackChannel.Send(new RoomEvent() { Text = msg.Text, UserName = msg.UserName });
     }
 }
开发者ID:Rurouni,项目名称:MassiveOnlineUniversalServerEngine,代码行数:7,代码来源:RoomActor.cs


示例4: Process

        public Task<Message> Process(Func<IOperationContext, Task<Message>> next, IOperationContext operation)
        {
            var lockType = LockType.Write;
            if (_lockConfig != null)
                lockType = _lockConfig.GetLockType(operation.Message.GetType());

            return _fiber.Call(() => next(operation), lockType);
        }
开发者ID:Rurouni,项目名称:MassiveOnlineUniversalServerEngine,代码行数:8,代码来源:FiberedMessageProcessor.cs


示例5: OperationContextOrgUnitContextStorage

        public OperationContextOrgUnitContextStorage(IOperationContext operationContext)
        {
            _operationContext = operationContext;

            // WCF operation context is null during app initialization.
            // We don't need to store OU context during that stage anyway.
            operationContextAvailable = _operationContext != null;
        }
开发者ID:rickeygalloway,项目名称:Test,代码行数:8,代码来源:OperationContextOrgUnitContextStorage.cs


示例6: OnSay

 void OnSay(Say msg, IOperationContext context)
 {
     if (_room != null)
     {
         _room.SendOneWay(new SayS2S(){UserName = _userName, Text = msg.Text}, context);    
     }
     else throw new ProcessingException(SayErrors.NotConnectedToRoom);
 }
开发者ID:Rurouni,项目名称:MassiveOnlineUniversalServerEngine,代码行数:8,代码来源:ChatClientNetChannel.cs


示例7: OnSay

 async Task OnSay(Say msg, IOperationContext context)
 {
     if (_room != null)
     {
         await _room.Say(new SayS2S() { UserName = _userName, Text = msg.Text });
     }
     else throw new ProcessingException(SayErrors.NotConnectedToRoom);
 }
开发者ID:Rurouni,项目名称:MassiveOnlineUniversalServerEngine,代码行数:8,代码来源:SFChatClientNetChannel.cs


示例8: Process

 async Task<OperationResult> Process(PingGateway msg, IOperationContext context)
 {
     using (BackendCallsTimer.NewContext())
     {
         await Task.Delay(msg.SleepDurationMs);
         return OperationResult.Success;
     }
 }
开发者ID:Rurouni,项目名称:MassiveOnlineUniversalServerEngine,代码行数:8,代码来源:MouseActorsBackendClientNetChannel.cs


示例9: UpdateClientIp

 private void UpdateClientIp(LocationContext location, IOperationContext operation)
 {
     if ( operation.HasIncomingMessageProperty(RemoteEndpointMessageProperty.Name) )
     {
         var property = (RemoteEndpointMessageProperty)
             operation.GetIncomingMessageProperty(RemoteEndpointMessageProperty.Name);
         location.Ip = property.Address;
         WcfEventSource.Log.LocationIdSet(location.Ip);
     }
 }
开发者ID:xornand,项目名称:ApplicationInsights-SDK-Labs,代码行数:10,代码来源:ClientIpTelemetryInitializer.cs


示例10: FindAssociatedOrgUnitIds

 public static IEnumerable<int> FindAssociatedOrgUnitIds(int? organizationalUnitId, DescendantOption descentantOption, LinkedOption linkedOption, IOperationContext operationContext, ObjectContext objectContext)
 {
     return
         AssociatedOrgUnitFinder.FindAssociatedOrgUnits(objectContext, new AssociatedOrgUnitsDto
         {
             OrganizationalUnitId = organizationalUnitId,
             DescendantOption = descentantOption,
             LinkedOption = linkedOption
         });
 }
开发者ID:rickeygalloway,项目名称:Test,代码行数:10,代码来源:SearchFilterMethods.cs


示例11: OnSay

 static void OnSay(Say msg, IOperationContext context)
 {
     RoomMember member;
     if (RoomMembers.TryGetValue(context.ReplyChannel, out member))
     {
         List<RoomMember> members;
         if (Rooms.TryGetValue(member.RoomName, out members))
         {
             members.ForEach((m) => m.UserChannel.Send(new RoomEvent() { UserName = member.UserName, Text = msg.Text }));
         }    
     }
 }
开发者ID:Rurouni,项目名称:MassiveOnlineUniversalServerEngine,代码行数:12,代码来源:Program.cs


示例12: OnInitialize

 /// <summary>
 /// Called when a telemetry item is available
 /// </summary>
 /// <param name="telemetry">The telemetry item to augment</param>
 /// <param name="operation">The operation context</param>
 protected override void OnInitialize(ITelemetry telemetry, IOperationContext operation)
 {
     var httpHeaders = operation.GetHttpRequestHeaders();
     if ( httpHeaders != null )
     {
         var userAgent = httpHeaders.Headers["User-Agent"];
         if ( !String.IsNullOrEmpty(userAgent) )
         {
             telemetry.Context.User.UserAgent = userAgent;
         }
     }
 }
开发者ID:xornand,项目名称:ApplicationInsights-SDK-Labs,代码行数:17,代码来源:UserAgentTelemetryInitializer.cs


示例13: OnInitialize

 /// <summary>
 /// Initialize the telemetry event with the client IP if available
 /// </summary>
 /// <param name="telemetry">The telemetry event</param>
 /// <param name="operation">The WCF operation context</param>
 protected override void OnInitialize(ITelemetry telemetry, IOperationContext operation)
 {
     if ( String.IsNullOrEmpty(telemetry.Context.Location.Ip) )
     {
         var location = operation.Request.Context.Location;
         if ( String.IsNullOrEmpty(location.Ip) )
         {
             UpdateClientIp(location, operation);
         }
         telemetry.Context.Location.Ip = location.Ip;
     }
 }
开发者ID:xornand,项目名称:ApplicationInsights-SDK-Labs,代码行数:17,代码来源:ClientIpTelemetryInitializer.cs


示例14: FindAssociatedOrgUnitIds

 public static IEnumerable<int> FindAssociatedOrgUnitIds(int? organizationalUnitId, DescendantOption descentantOption, LinkedOption linkedOption, IOperationContext operationContext, ObjectContext objectContext)
 {
     var key = string.Concat("AssociatedOrgUnitIds_", organizationalUnitId, "_", descentantOption, "_", linkedOption);
     //return operationContext.FindOrCreate<IEnumerable<int>>(key, () =>
     //{
         return
             AssociatedOrgUnitFinder.FindAssociatedOrgUnits(objectContext, new AssociatedOrgUnitsDto
             {
                 OrganizationalUnitId = organizationalUnitId,
                 DescendantOption = descentantOption,
                 LinkedOption = linkedOption
             });
     //});
 }
开发者ID:rickeygalloway,项目名称:Test,代码行数:14,代码来源:SearchFilterMethods.cs


示例15: OnRoomJoin

        async Task<JoinRoomResponse> OnRoomJoin(JoinRoom msg, IOperationContext context)
        {
            var room = ActorProxy.Create<ISFRoomActor>(new ActorId(msg.RoomName));

            await room.SubscribeAsync(this);

            var joinRoomOnServer = new JoinRoomS2S()
            {
                RoomName = msg.RoomName,
                UserName = msg.UserName
            };
            var reply = await room.JoinRoom(joinRoomOnServer);
            if (reply.RetCode == JoinRoomRetCode.Ok)
            {
                _room = room;
                _userName = msg.UserName;
            }

            return reply;
        }
开发者ID:Rurouni,项目名称:MassiveOnlineUniversalServerEngine,代码行数:20,代码来源:SFChatClientNetChannel.cs


示例16: OnRoomJoin

        async Task<JoinRoomResponse> OnRoomJoin(JoinRoom msg, IOperationContext context)
        {
            var room = await _rooms.GetActor(new ActorKey(msg.RoomName));

            var callbackRef = _callbacksNode.ExposeAsCallbackChannel(this);
            var joinRoomOnServer = new JoinRoomS2S()
            {
                CallbackChannelRef = callbackRef,
                RoomName = msg.RoomName,
                UserName = msg.UserName
            };
            var reply = await room.SendAsync<JoinRoomResponse>(joinRoomOnServer, context);
            if (reply.RetCode == JoinRoomRetCode.Ok)
            {
                _room = room;
                _userName = msg.UserName;
            }

            return reply;
        }
开发者ID:Rurouni,项目名称:MassiveOnlineUniversalServerEngine,代码行数:20,代码来源:ChatClientNetChannel.cs


示例17: Process

 public Task<Message> Process(Func<IOperationContext, Task<Message>> next, IOperationContext context)
 {
     Func<IOperationContext, Task<Message>> handler;
     if (_messageHandlingConfig.TryGetHandlerFor(context.Message.GetType(), out handler))
     {
         return handler(context);
     }
     else if (next != null)
     {
         return next(context);
     }
     else if (_throwIfUnhandled)
     {
         throw new ProcessingException(BasicErrorCode.DispatcherFuncNotFound);
     }
     else
     {
         return Task.FromResult<Message>(null);
     }
 }
开发者ID:Rurouni,项目名称:MassiveOnlineUniversalServerEngine,代码行数:20,代码来源:DispatchingMessageProcessor.cs


示例18: ArgumentNullException

        void IWcfTelemetryModule.OnError(IOperationContext operation, Exception error)
        {
            if ( operation == null )
                throw new ArgumentNullException("operation");
            if ( error == null )
                throw new ArgumentNullException("error");
            if ( telemetryClient == null )
                return;

            ExceptionTelemetry telemetry = new ExceptionTelemetry(error);
            if ( error is FaultException )
            {
                telemetry.SeverityLevel = SeverityLevel.Error;
                telemetry.HandledAt = ExceptionHandledAt.UserCode;
            } else
            {
                telemetry.SeverityLevel = SeverityLevel.Critical;
                telemetry.HandledAt = ExceptionHandledAt.Platform;
            }
            telemetryClient.TrackException(error);
        }
开发者ID:xornand,项目名称:ApplicationInsights-SDK-Labs,代码行数:21,代码来源:ExceptionTrackingTelemetryModule.cs


示例19: GetObjectOfLatestVersion

        public IDocument GetObjectOfLatestVersion(bool major, IOperationContext context)
        {
            string objectId;
            string versionSeriesId;

            Lock();
            try
            {
                objectId = ObjectId;
                versionSeriesId = VersionSeriesId;
            }
            finally
            {
                Unlock();
            }

            if (versionSeriesId == null)
            {
                throw new CmisRuntimeException("Version series id is unknown!");
            }

            IObjectData objectData = Binding.GetVersioningService().GetObjectOfLatestVersion(RepositoryId, objectId, versionSeriesId, major,
                context.FilterString, context.IncludeAllowableActions, context.IncludeRelationships, context.RenditionFilterString,
                context.IncludePolicies, context.IncludeAcls, null);

            IDocument result = Session.ObjectFactory.ConvertObject(objectData, context) as IDocument;
            if (result == null)
            {
                throw new CmisRuntimeException("Latest version is not a document!");
            }

            return result;
        }
开发者ID:emrul,项目名称:CmisSync,代码行数:33,代码来源:client-objects.cs


示例20: GetAllVersions

        public IList<IDocument> GetAllVersions(IOperationContext context)
        {
            string objectId;
            string versionSeriesId;

            Lock();
            try
            {
                objectId = ObjectId;
                versionSeriesId = VersionSeriesId;
            }
            finally
            {
                Unlock();
            }

            IList<IObjectData> versions = Binding.GetVersioningService().GetAllVersions(RepositoryId, objectId, versionSeriesId,
                context.FilterString, context.IncludeAllowableActions, null);

            IObjectFactory of = Session.ObjectFactory;

            IList<IDocument> result = new List<IDocument>();
            if (versions != null)
            {
                foreach (IObjectData objectData in versions)
                {
                    IDocument doc = of.ConvertObject(objectData, context) as IDocument;
                    if (doc == null)
                    {
                        // should not happen...
                        continue;
                    }

                    result.Add(doc);
                }
            }

            return result;
        }
开发者ID:emrul,项目名称:CmisSync,代码行数:39,代码来源:client-objects.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IOperationLock类代码示例发布时间:2022-05-24
下一篇:
C# IOperation类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap