Posts

Showing posts with the label C#7.0

Simple way to generate C# class from database table

 Use the below sql script to generate c# model corresponding to the table.   Set @TableName to the name of your table.   declare @TableName sysname = 'TableName' declare @Result varchar (max) = 'public class ' + @TableName + '{' select @Result = @Result + ' public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; }' from ( select replace(col.name, ' ' , '_' ) ColumnName, column_id ColumnId, case typ.name when 'bigint' then 'long' when 'binary' then 'byte[]' when 'bit' then 'bool' when 'char' then 'string' when 'date' then 'DateTime' when 'datetime' then 'DateTime' when 'datetime2' then 'DateTime' when 'datetim

Azure Functions – Time Trigger (CRON)

Expression Description runs at 0 * * * * * every minute 09:00:00; 09:01:00; 09:02:00; … 10:00:00 0 */5 * * * * every 5 minutes 09:00:00; 09:05:00 0 0 * * * * every hour (hourly) 09:00:00; 10:00:00; 11:00:00 0 0 */6 * * * every 6 hours 06:00:00; 12:00:00; 18:00:00; 00:00:00 0 0 8-18 * * * every hour between 8-18 08:00:00; 09:00:00; … 18:00:00; 08:00:00 0 0 0 * * * every day (daily) Mar 1, 2017 00:00:00; Mar 2, 2017 00:00:00 0 0 10 * * * every day at 10:00:00 Mar 1, 2017 10:00:00; Mar 2, 2017 10:00:00 0 0 * * * 1-5 every hour on workdays Mar 3 (FRI), 2017 22:00:00; Mar 3 (FRI), 2017 23:00:00; Mar 6 (MON), 2017 00:00:00 0 0 0 * * 0 every sunday (weekly) Mar 5 (SUN), 2017 00:00:00; Mar 12 (SUN), 2017 00:00:00 0 0 9 * * MON every monday at 09:00:00 Mar 6 (MON), 2017 09:00:00; Mar 13 (MON), 2017 09:00:00 0 0 0 1 * * every 1st of month (monthly) Mar 1, 2017 00:00:00; Apr 1, 2017 00:00:00; May 1, 2017 00:00:00 0 0 0 1 1 * every 1st of january (yearly) Jan 1, 2017 00:00:00; Jan 1, 2018 00:00:00

Method inside a Method in c# 7.0

A new feature was introduced in c# 7.0, in which we can call a local methods to be defines and call within a method. This feature was not in the previous versions. Which is like, defining the call back function just above the method in jquery. The blow is as sample code static void Main(string[] args)   {     void Display(string str)     {       Console.WriteLine(str);   }        Display("Hello world....")     Console.ReadKey();   }