TL;DR A single INSERT/UPDATE/DELETE statement is run within an implicit transaction scope regardless of how many records they modify A transaction must be explicitly rolled back upon error After a transaction is rolled back, the error should be raised so that the script runner becomes aware of the error A single INSERT/UPDATE/DELETE statement Each individual INSERT/UPDATE/DELETE statement is run by SQL Server within an implicit transaction scope. This is regardless of the number of records affected by these statements.

Continue reading

Git TFS is a program that extends git commands to talk to a TFS remote repository (instead of a git repository). It creates a real git repository and replays the TFS history on top of it. It can be treated as a real git repository except for when it comes to cloning and syncing. In spite of that it still makes a programmer’s life much easier. The best starting point is the project’s ReadMe file on GitHub.

Continue reading

The source code for this post is on GitHub. When it comes to mocking a DbSet to test various read and write operations things may get a little bit tricky. Mocking a DbSet for a write operation (Add, Update, or Remove) is quite straightforward. But testing a synchronous read operation requires mocking the whole IQueryable interface. Even more trickier than that is testing an asynchronous read operation which requires mocking an IDbAsyncQueryProvider interface.

Continue reading

The switch data type is used to control whether a switch (as in arguments or options passed to a function or command) is provided for the function/command or not. Suppose that there is a function called Switch-Demo that can accept -Force and -Quiet switches. These switches just work as toggles. What we care about them is whether they exist or not. There are no pieces of data accompanying them. The PowerShell switch data-type suits this purpose:

Continue reading

I recently created a library that contains some handy extensions for INotifyPropertyChanged interface (aka INPC). To start using the library, add the following to the top of your C# code: using NotifyPropertyChangedExtensions; How to easily raise INPC in a refactor friendly way public class MyClass : INotifyPropertyChanged { private int _number; public int Number { get { return _number; } set { if(_number != value) { _number = value; this.

Continue reading

Years ago I created a tool called Code4Public to convert source code into HTML called. I was using this tool to put nice code snippets in the blog I used to maintain at that time. The tool is able to get the code, apply syntax highlighting to it based on the syntax of the language selected, and then create HTML based on the theme selected (e.g., MSDN theme). I didn’t assign more time on making the tool better and better, as better ways of doing the same task were emerging, and also other by-products of the tool were becoming more interesting at the time; e.

Continue reading

I could gracefully install and test earlier versions of Android Studio before they adopted Gradle for their build system. After doing the upgrade I could no longer build a single project with weird error messages relating to Gradle. I searched the web, and found some workarounds in stackoverflow, e.g., manually installing Gradle, updating environment variables and so and so. None of them were helpful for me, although they seemed to be solving the issue for many (who have voted for the answers).

Continue reading

Author's picture

Sina Iravanian

Movie music junkie, insomniac, daydreamer, procrastinator, hard-determinist, introvert, and a bit into software.

Software Developer

Melbourne, Australia