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
private static void DiscoverService() | |
{ | |
var instance = Cluster.FindServiceInstanceAsync("customers").Result; | |
Console.WriteLine($"{instance.Address} {instance.Port}"); | |
Console.ReadLine(); | |
} |
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
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
Cluster.Bootstrap(new NancyProvider(), new ConsulProvider(), "customers", "v1"); | |
Console.ReadLine(); | |
} | |
} |
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 static List<BankAccount> GetList() | |
{ | |
string sqlQuery = @"SELECT | |
BA.Id, BA.Account, BA.Branch, | |
U.Id, U.Name, | |
A.Id, A.Street, A.City, | |
C.Id, C.Name, | |
BK.Id, BK.Name, | |
ACT.Id, ACT.Name, | |
ACC.Id, ACC.Name, |
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 Newtonsoft.Json; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Net; | |
using Velyo.Google.Services.Models; | |
namespace CepApp | |
{ | |
public class AddressUtil |
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.Configuration; | |
using MySql.Data.MySqlClient; | |
namespace Data.Dapper.Class | |
{ | |
public abstract class BaseRepository | |
{ | |
public string connstringSQL = ConfigurationManager.ConnectionStrings["SqlServerConnString"].ConnectionString; | |
public MySqlConnection GetMySqlConnection(bool open = 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
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.DependencyInjection; | |
namespace SwaggerAspnetCore | |
{ | |
public class Startup | |
{ | |
public Startup(IConfiguration configuration) |
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 string RetrieveSingleMessage(string queueName, IConnection connection) | |
{ | |
BasicGetResult data; | |
using (var channel = connection.CreateModel()) | |
{ | |
data = channel.BasicGet(queueName, true); | |
} | |
return data != null ? System.Text.Encoding.UTF8.GetString(data.Body) : null; | |
} |
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 bool WriteMessageOnQueue(string message, string queueName, IConnection connection) | |
{ | |
using (var channel = connection.CreateModel()) | |
{ | |
channel.BasicPublish(string.Empty, queueName, null, Encoding.ASCII.GetBytes(message)); | |
} | |
return 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 QueueDeclareOk CreateQueue(string queueName, IConnection connection) | |
{ | |
QueueDeclareOk queue; | |
using (var channel = connection.CreateModel()) | |
{ | |
queue = channel.QueueDeclare(queueName, false, false, false, null); | |
} | |
return queue; | |
} |
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 IConnection CreateConnection(ConnectionFactory connectionFactory) | |
{ | |
return connectionFactory.CreateConnection(); | |
} |