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
| PK_ for primary keys | |
| UK_ for unique keys | |
| IX_ for non clustered non unique indexes | |
| UX_ for unique indexes | |
| All of my index name take the form of | |
| <index or key type>_<table name>_<column 1>_<column 2>_<column n> |
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
| $folder = $args[0] | |
| $configuration = $args[1] | |
| $xunit = $args[2] | |
| $testType = $args[3] | |
| $service = $args[4] | |
| $category = $args[5] | |
| try | |
| { | |
| Start-Transcript -Path C:\output.txt -Append |
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 class TaskExtensions | |
| { | |
| public static Task Catch(this Task task, Action<Exception> exceptionHandler) | |
| { | |
| return task.ContinueWith(t => | |
| { | |
| if (t.IsCanceled || !t.IsFaulted || exceptionHandler == null) | |
| { | |
| return; | |
| } |
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
| //Create a CTS to launch a task in charge of renewing the message lock | |
| var brokeredMessageRenewCancellationTokenSource = new CancellationTokenSource(); | |
| try | |
| { | |
| var brokeredMessage = _client.Receive(); | |
| var brokeredMessageRenew = Task.Factory.StartNew(() => | |
| { | |
| while (!brokeredMessageRenewCancellationTokenSource.Token.IsCancellationRequested) |
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
| private async Task OnMessageReceivedAsync(BrokeredMessage receivedMessage) | |
| { | |
| try{ | |
| var messageLock = new MessageLock(receivedMessage)){ | |
| // Process receivedMessage | |
| await messageLock.CompleteAsync(); | |
| } | |
| finally { | |
| messageLock.Dispose(); |
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 IEnumerable<SendMailRequestBackoffice> BuildQuery(int statusId, int isSpam, string advertId, int sourceSite, | |
| int destSite, string dateFrom, string dateTo, string textSearch) | |
| { | |
| var requests = DbContext.SendMailRequests.Where(req => req.StatusId == statusId && req.IsSpam == isSpam); | |
| if (sourceSite != 0) | |
| { | |
| requests = requests.Where(req => req.SrcSiteId == sourceSite); | |
| } |
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
| WITH SubTree (Id, ParentId, Branch) | |
| AS ( | |
| SELECT Id, ParentId, 1 AS Branch | |
| FROM Subdivisions | |
| WHERE Id = 146000 | |
| UNION ALL | |
| SELECT s.Id, s.ParentId, t.Branch + 1 AS Branch | |
| FROM Subdivisions s | |
| JOIN SubTree t ON t.ParentId = s.Id | |
| ) |