Options pattern https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-7.0 OptionMonitor OptionSnapshot IConfiguration Option -> once application is loaded the value will not change. The application has to be restarted. Aws Systems Manager - create parameter store https://www.youtube.com/watch?v=J0EVd5HbtUY
Download Nuget package Mysql.Data Import namespace MySql.Data.MySqlClient Construct the connectionstring eg., server=localhost;user=root;password=secret;database=myDatabase Employees has three rows EmployeeId, FirstName and LastName var connectionString = $"server={dbCon.Server};user={dbCon.UserName};password={dbCon.Password};database={dbCon.DatabaseName}"; using var connection = new MySqlConnection(connectionString); connection.Open(); string query = "select * from Employees"; var cmd = new MySqlCommand(query, connection); var reader = cmd.ExecuteReader(); while (reader.Read()){ Console.WriteLine($"{reader.GetString(0)} {reader.GetString(1)} {reader.GetString(2)}"); }
LINQ in C# Chaining using System; using System.Linq; public class Program { public static void Main() { string[] names = { "Tom", "Radha" , "Madhusudan", "Madhan" ,"Harry" , "Michael" }; var filteredNames = names.Where(n => n.Length > 4).OrderByDescending(n=>n); IEnumerable<string> filteredNames1 = System.Linq.Enumerable.Where(names, n => n.Contains("rr")); IEnumerable<string> filteredNames1 = System.Linq.Enumerable.Where(names, n => n.Contains('a')); Console.WriteLine(names.Min((n => n.Length))); Console.WriteLine(names.Max((n => n.Length))); Console.WriteLine(names.Average((n => n.Length))); Console.WriteLine("-----"); var query = from name in names where name.Length > 3 select name; foreach(var name in query){ Console.WriteLine(name); } Console.WriteLine("-----"); foreach(var name in ...
Comments
Post a Comment