本文整理汇总了C#中IOperationContext类的典型用法代码示例。如果您正苦于以下问题:C# IOperationContext类的具体用法?C# IOperationContext怎么用?C# IOperationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IOperationContext类属于命名空间,在下文中一共展示了IOperationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
async Task<OperationResult> Process(TestStatelessUnreliable msg, IOperationContext arg2)
{
if (msg.SleepDurationMs > 0)
await Task.Delay(msg.SleepDurationMs);
return OperationResult.Success;
}
示例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.
}
*/
}
示例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 });
}
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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
});
}
示例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 }));
}
}
}
示例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;
}
}
}
示例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;
}
}
示例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
});
//});
}
示例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;
}