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
| // ========================================================== | |
| // The real resource | |
| class InternalResource { | |
| public void DoSomething() { } | |
| } | |
| // ========================================================== | |
| // The external wrapper returned to the consumer | |
| class MyResource : IDisposable { | |
| private PoolItem<InternalResource> _poolItem; |
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 class DTO : SerializableDynamicObject | |
| { | |
| [Required] | |
| public DTOEventType EventType | |
| { | |
| get { return GetValue<DTOEventType>(nameof(EventType)); } | |
| set { SetValue(nameof(EventType), value); } | |
| } | |
| } |
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
| [Fact] | |
| public void WithAutoFixture() | |
| { | |
| var fixture = new Fixture(); | |
| fixture.Customize(new AutoMoqCustomization()); // set up automocking | |
| var dependency1stub = fixture.Freeze<Mock<IDependecy1>>(); | |
| var dependency2mock = fixture.Freeze<Mock<IDependecy2>>(); | |
| dependency1stub.Setup(x => x.SomeQuery()).Returns(2); | |
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
| Delete a Git branch both locally and remotely | |
| To delete any branch from VSO, you have to enable Alternate Authentication Credentials | |
| Open VSO web browser. | |
| Click on your name in the top right | |
| Click on My Profile | |
| Click on Credentials | |
| Configure Alternate Authentication Credentials | |
| Now open Visual Studio | |
| Connect VSO. | |
| Click on Team Explorer |
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
| GRANT CREATE PROCEDURE TO [SqlUser]; | |
| GRANT CREATE SERVICE TO [SqlUser]; | |
| GRANT CREATE QUEUE TO [SqlUser]; | |
| GRANT REFERENCES ON CONTRACT::[http://schemas.microsoft.com/SQL/Notifications/PostQueryNotification] TO [SqlUser]; | |
| GRANT SUBSCRIBE QUERY NOTIFICATIONS TO [SqlUser]; | |
| GRANT CONTROL ON SCHEMA::[dbo] TO [SqlUser]; | |
| GRANT IMPERSONATE ON USER::DBO TO [SqlUser]; | |
| -- This acually works | |
| -- https://social.msdn.microsoft.com/Forums/sqlserver/en-US/bd195da8-93b2-43c6-8f59-674f5fb9d618/cannot-find-the-queue-sqlquerynotificationserviceguid?forum=sqlservicebroker&prof=required |
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
| Windows Registry Editor Version 5.00 | |
| [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\narrator.exe] | |
| "Debugger"="%1" | |
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
| # | |
| # Powershell script that deploys the dacpac to (localdb)\MSSQLLocalDB that the integration tests can run against. | |
| # | |
| $dbname = "xxx" | |
| $dacpacname = "xxx.dacpac" | |
| # Locate dacpac | |
| $dacpac = gci -Recurse -Filter "$dacpacname" -ErrorAction SilentlyContinue | Select -First 1 |
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
| [AttributeUsage(AttributeTargets.Method)] | |
| public class ValidationActionFilterAttribute : ActionFilterAttribute | |
| { | |
| public override void OnActionExecuting(HttpActionContext actionContext) | |
| { | |
| InnerOnActionExecuting(actionContext); | |
| var modelState = actionContext.ModelState; | |
| if (modelState.IsValid) |
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
| // JS array equivalents to C# LINQ methods - by Dan B. | |
| // Here's a simple array of "person" objects | |
| var people = [ | |
| { name: "John", age: 20 }, | |
| { name: "Mary", age: 35 }, | |
| { name: "Arthur", age: 78 }, | |
| { name: "Mike", age: 27 }, | |
| { name: "Judy", age: 42 }, | |
| { name: "Tim", age: 8 } |
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
| fix by adding following line | |
| ------------- | |
| options.exclude = options.exclude.split ',' | |
| in cli.coffee | |
| (Windows path: C:\Users\xxx\AppData\Roaming\npm\node_modules\jscpd\src\cli\) | |
| jscpd -g csharp -o report.txt --exclude **/*.Designer.cs,**/XsdGeneratedClasses.cs |