This file contains hidden or 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 void Execute(IServiceProvider serviceProvider) | |
| { | |
| ITracingService tracer = (ITracingService) serviceProvider.GetService(typeof(ITracingService)); | |
| tracer.Trace("Traza que queremos dejar"); | |
| } |
This file contains hidden or 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
| #Source: https://stackoverflow.com/questions/52722373/create-database-and-collection-on-cosmos-db-sql-api-inside-azuredevopps-vsts | |
| param($endpoint, $masterKey, $databaseName, $collectionName, $collectionRUs, $partitionKey) | |
| Add-Type -AssemblyName System.Web | |
| Add-Type -TypeDefinition @" | |
| public enum CosmosResourceType | |
| { | |
| Database, | |
| Collection | |
| } |
This file contains hidden or 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
| System.Net.ServicePointManager.SecurityProtocol = | |
| SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | | |
| SecurityProtocolType.Tls12; |
This file contains hidden or 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.Threading.Tasks; | |
| namespace ConsoleAsyncDemo | |
| { | |
| static class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Main().Wait(); | |
| } |
This file contains hidden or 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 BulkUploadToSql<T> | |
| { | |
| public IList<T> InternalStore { get; set; } | |
| public string TableName { get; set; } | |
| public int CommitBatchSize { get; set; } = 1000; | |
| public SqlConnection Connection { get; set; } | |
| public async Task Commit() | |
| { | |
| if (InternalStore.Count > 0) |
This file contains hidden or 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 string GetCreateTableQuery<T>(IEnumerable<T> list, string tableName) | |
| { | |
| Type type = typeof(T); | |
| var properties = type.GetProperties(); | |
| var query = new StringBuilder(); | |
| query.Append($"CREATE TABLE {tableName} ("); | |
| foreach (PropertyInfo info in properties) | |
| { |
This file contains hidden or 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
| static void EjemploRandom3() | |
| { | |
| for (int i = 0; i <= 10; i++) | |
| { | |
| var guid = Guid.NewGuid(); | |
| var justNumbers = new String(guid.ToString().Where(Char.IsDigit).ToArray()); | |
| var seed = int.Parse(justNumbers.Substring(0, 4)); | |
| var random = new Random(seed); | |
| var value = random.Next(0, 5); |
This file contains hidden or 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
| static void EjemploConTickCount() | |
| { | |
| var seed = Environment.TickCount; | |
| var random = new Random(seed); | |
| for (int i = 0; i <= 10; i++) | |
| { | |
| var value = random.Next(0, 5); | |
| Console.WriteLine($"Iteración {i} - semilla {seed} - valor {value}"); | |
| } |
This file contains hidden or 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
| static void EjemploRandom1() | |
| { | |
| for (int i = 0; i <= 10; i++) | |
| { | |
| var seed = Environment.TickCount; | |
| var random = new Random(seed); | |
| var value = random.Next(0, 5); | |
| Console.WriteLine($"Iteración {i} - semilla {seed} - valor {value}"); | |
| } |
This file contains hidden or 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 AzureTableStorage<T> where T : TableEntity, IAzureStorageTable, new() | |
| { | |
| CloudStorageAccount storageAccount = CloudStorageAccount.Parse( | |
| CloudConfigurationManager.GetSetting("StorageConnectionString")); | |
| CloudTableClient tableClient; | |
| CloudTable table; | |
| public AzureTableStorage(string tableName) | |
| { |