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 Microsoft.Extensions.Configuration; | |
| namespace CoolApp.ApplicationService | |
| { | |
| public class JsonAppConfigService : IAppConfigService | |
| { | |
| private readonly string _defaultCurrency; | |
| public JsonAppConfigService(IConfiguration configuration) | |
| { | |
| _defaultCurrency = configuration["DefaultCurrency"]; |
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
| namespace CoolApp.ApplicationService | |
| { | |
| public interface IAppConfigService | |
| { | |
| string GetDefaultCurrency(); | |
| } | |
| } |
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
| namespace DotConnect.LeakyAbstraction | |
| { | |
| public interface IIndexedTeacherCollection | |
| { | |
| int GetIndex(string teacherName); | |
| } | |
| } |
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; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| namespace DotConnect.LeakyAbstraction | |
| { | |
| public class TeacherCollection : IEnumerable<Teacher> | |
| { | |
| private readonly IList<Teacher> _teachers = new List<Teacher>(); |
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
| IF DATABASEPROPERTYEX (N'DB_NAME', N'Version') > 0 | |
| BEGIN | |
| ALTER DATABASE [DB_NAME] SET SINGLE_USER | |
| WITH ROLLBACK IMMEDIATE; | |
| DROP DATABASE [DB_NAME]; | |
| END | |
| GO |
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
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Console.WriteLine("Demo the readability of the code from method parameters"); | |
| var hr = new HrDepartment(); | |
| var applicantCvs = new List<VerificationContext>{ | |
| new VerificationContext() | |
| { | |
| ApplicantCv = {ApplicantName = "Batman"}, |
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; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| public class VerificationContext | |
| { | |
| public string SpecialNotes { get; set; } | |
| public ApplicantCv ApplicantCv { get; set; } | |
| } |
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
| -- Configure the blocked process threshold for 10 seconds. | |
| -- Be careful with the number. If we set it too low, there will be too many events generated. | |
| EXEC sp_configure 'show advanced options', 1; | |
| GO | |
| RECONFIGURE; | |
| GO | |
| EXEC sp_configure 'blocked process threshold', 5; | |
| GO | |
| RECONFIGURE; | |
| GO |
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
| DECLARE @TraceID INT; | |
| DECLARE @filesize BIGINT = 10; | |
| EXECUTE sp_trace_create | |
| @TraceID = @TraceID OUTPUT, | |
| @Options = 2, -- TRACE_FILE_ROLLOVER, | |
| @tracefile = N'D:\a location\tracecfilewithoutextension', | |
| @maxfilesize = @filesize, | |
| @stoptime = NULL, | |
| @filecount = 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
| SELECT L.request_session_id AS SPID, | |
| DB_NAME(L.resource_database_id) AS DatabaseName, | |
| O.Name AS LockedObjectName, | |
| P.object_id AS LockedObjectId, | |
| L.resource_type AS LockedResource, | |
| L.request_mode AS LockType, | |
| ST.text AS SqlStatementText, | |
| ES.login_name AS LoginName, | |
| ES.host_name AS HostName, |
NewerOlder