public void Handle(AddAuditLogEntryCommand command)
        {
            var client = new AuditLogClient(ChannelFactory.Create(_configuration["Services:AuditLog:Grpc"]));

            client.AddAuditLogEntry(new AuditLog.Grpc.AddAuditLogEntryRequest
            {
                Entry = new AuditLog.Grpc.AuditLogEntryMessage
                {
                    ObjectId        = command.AuditLogEntry.ObjectId,
                    UserId          = command.AuditLogEntry.UserId.ToString(),
                    Action          = command.AuditLogEntry.Action,
                    Log             = command.AuditLogEntry.Log,
                    CreatedDateTime = Timestamp.FromDateTimeOffset(command.AuditLogEntry.CreatedDateTime),
                },
            });
        }
コード例 #2
0
        public void Handle(AddAuditLogEntryCommand command)
        {
            var client = new AuditLogClient(ChannelFactory.Create("https://localhost:5002"));

            client.AddAuditLogEntry(new AuditLog.Grpc.AddAuditLogEntryRequest
            {
                Entry = new AuditLog.Grpc.AuditLogEntryMessage
                {
                    ObjectId        = command.AuditLogEntry.ObjectId,
                    UserId          = command.AuditLogEntry.UserId.ToString(),
                    Action          = command.AuditLogEntry.Action,
                    Log             = command.AuditLogEntry.Log,
                    CreatedDateTime = Timestamp.FromDateTimeOffset(command.AuditLogEntry.CreatedDateTime),
                },
            });
        }
        public void Handle(AddAuditLogEntryCommand command)
        {
            var token   = _httpContextAccessor.HttpContext.GetTokenAsync(OpenIdConnectParameterNames.AccessToken).GetAwaiter().GetResult();
            var headers = new Metadata
            {
                { "Authorization", $"Bearer {token}" },
            };

            var client = new AuditLogClient(ChannelFactory.Create(_configuration["Services:AuditLog:Grpc"]));

            client.AddAuditLogEntry(new AuditLog.Grpc.AddAuditLogEntryRequest
            {
                Entry = new AuditLog.Grpc.AuditLogEntryMessage
                {
                    ObjectId        = command.AuditLogEntry.ObjectId,
                    UserId          = command.AuditLogEntry.UserId.ToString(),
                    Action          = command.AuditLogEntry.Action,
                    Log             = command.AuditLogEntry.Log,
                    CreatedDateTime = Timestamp.FromDateTimeOffset(command.AuditLogEntry.CreatedDateTime),
                },
            }, headers);
        }