This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In file web.config: | |
<appender name="AdoNetAppender" type="Config.CustomAdoNetAppender"> | |
.... | |
In file cs: | |
public class CustomAdoNetAppender : AdoNetAppender | |
{ | |
public override void ActivateOptions() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = ConnectionToElasticSearch.EsClient(); | |
var IndexDes = new CreateIndexDescriptor("ObjectName") | |
.Mappings(ms => ms | |
.Map<JobPostingInfo>(m => m | |
.Properties(p => p | |
.Text(t => t | |
.Name(n => n.Title) | |
.Fields(ff => ff | |
.Text(tt => tt | |
.Name("b_Title").Analyzer("b_Title") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BlobsRepository | |
{ | |
string _connectionString = ""; | |
string _containerName = "arquivos"; | |
public CloudBlobContainer GetCloudBlobContainer() | |
{ | |
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(_connectionString); | |
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); | |
CloudBlobContainer container = blobClient.GetContainerReference("arquivos"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Authorization; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.WindowsAzure.Storage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var clientId = "000000000000000"; | |
var clientSecret = "XXXXXXXXXXXXXXX"; | |
var vaultUri = "https://nomekeyvault.vault.azure.net/"; | |
var authenticator = function(challenge, callback) { | |
var context = new AuthenticationContext(challenge.authorization); | |
return context.acquireTokenWithClientCredentials(challenge.resource, clientId, clientSecret, function(err, tokenResponse) { | |
if (err) throw err; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"RabbitMq": { | |
"Username": "xxxxxxx", | |
"Password": "xxxxxxx", | |
"VirtualHost": "xxxxxxx", | |
"Port": 5672, | |
"Hostnames": [ "xxxxxxx" ], | |
"RequestTimeout": "00:00:10", | |
"PublishConfirmTimeout": "00:00:01", | |
"RecoveryInterval": "00:00:10", | |
"PersistentDeliveryMode": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BusSubscriber : IBusSubscriber | |
{ | |
private readonly IBusClient _busClient; | |
private readonly IServiceProvider _serviceProvider; | |
public BusSubscriber(IApplicationBuilder app) | |
{ | |
_serviceProvider = app.ApplicationServices.GetService<IServiceProvider>(); | |
_busClient = _serviceProvider.GetService<IBusClient>(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleCreatedEventHandler : IRequestHandler<SampleCreatedEvent> | |
{ | |
public async Task<Unit> Handle(SampleCreatedEvent request, CancellationToken cancellationToken) | |
{ | |
Log.Information($"{nameof(SampleCreatedEvent)} = {request.Result}"); | |
return Unit.Value; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ApiController] | |
[Route("[controller]")] | |
public class SenderController : ControllerBase | |
{ | |
private readonly IBusPublisher _busPublisher; | |
public SenderController(IBusPublisher busPublisher) | |
{ | |
_busPublisher = busPublisher; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleCreatedEventHandler : IRequestHandler<SampleCreatedEvent> | |
{ | |
public async Task<Unit> Handle(SampleCreatedEvent request, CancellationToken cancellationToken) | |
{ | |
Log.Information($"{nameof(SampleCreatedEvent)} = {request.Result}"); | |
return Unit.Value; | |
} | |
} |
OlderNewer