Skip to main content

Posts

Showing posts from September, 2020

Backup and Restore Database Commands

  BACKUP   DATABASE   [DB_Name]         TO   DISK   =   N'\\server\directory\backupfile.bak'         WITH   NOFORMAT ,   INIT ,   NAME = N'DBNAME' ,   SKIP ,      NOREWIND ,   NOUNLOAD ,   STATS = 10 ;   RESTORE   FILELISTONLY                FROM   DISK =   N '\\server\directory\backupfile.bak'   DROP   DATABASE   [DB_Name]   ;   RESTORE   DATABASE   [DB_Name]             FROM   DISK = ' '\\server\directory\backupfile.bak'         WITH         MOVE   'DB_logicalName'   TO                'D:\Databases\data file name....

Using GetEnumerator

  The tips are:  Seems to work better if you know the type you want back from GetEnumerator, notice the IEnumerator<Employee> Notice the use of Current

Good article on getting the right characters of a string in C#

Left, Right, SubString C#   https://kodify.net/csharp/strings/left-right-mid/#left-right-and-mid-string-segments-in-c Feature Description C# equivalent Left Get specific number of characters ( count ) from left part string.Substring(0, count) Right Get specific number of characters ( count ) from right side string.Substring(string.Length - count, count) Mid Get a specific number of characters ( count ) starting at a certain point ( index ) string.Substring(index, count) Mid Get all characters starting at a certain point ( index ) string.Substring(index)

How to trust IIS Certificates for Development

 Type the following on a command line  > dotnet dev-certs https --trust If you're accessing the dev site from another computer or device, via an application, you can disable ssl certificate checking in the client app with... HttpClientHandler handler = new HttpClientHandler(); handler.ServerCertificateCustomValidationCallback = ( message, cert, chain, errors ) =>  { if(cert.Issuer.Equals("CN=localhost"))                    { return true;                     } return errors == System.Net.Security.SslPolicyErrors.None; }; Notes about Android and Xamarin Requires TLS 1.2 The default AndroidClientHandler supports TLS 1.2, but only for Android versions greater than 4.1 If an Android version is needed that is lower than 4.1, then we'll need to use the HttpClientHandler which supports TLS 1.0.  It is slower and increases the package size...