If you notice that the context returns the same entity even if it is already changed one line before, you probably what the following
ObjectContext context = ((IObjectContextAdapter)this.Context).ObjectContext;
You can use it right after obtaining an entity with a statement like follows:
var order = this.Context.Order.Single(e => e.ID == id);
In the middle of a project you might want to automate DB restoring and upgrading by means of existing SQL scripts which may contain GO-statements. If you are that person who is attempting to execute scripts at runtime with GO-statements, this article describes how to do that.
In some cases it’s very challenging to recreate all data for some use case. It much easier to run the application, create some starting point: people, products, orders, prices, amounts, etc. and use such DB during tests. Automated tests should restore such DB in a test sandbox, run tests and drop the DB. All test frameworks have possibility to run some […]
My list of Visual Studio extensions which make developing easier and more comfortable. Tool Description ILSpy Integrates the ILSpy decompiler into Visual Studio. ILSpy is the open-source .NET assembly browser and decompiler. Milti Language Spell Checker An editor extension that checks the spelling of comments, strings, and plaintext as you type. T4 Toolbox for Visual Studio […]
- June 26, 2015
#MSTest, #NUnit, #TDD, ...
Is xUnit is a modern and future proof solution for unit testing? I’m measuring pros and cons of xUnit and NUnit for the big and old legacy application. At the first go I thrown away MsTest because the more efforts are required to do the same things. Also it is not as extendible as others. […]
This issue is experienced while opening the test explorer or running all tests in VS. To resolve the issue try the following steps: Close all instances of Visual Studio. Delete all files in AppData\Local\Microsoft\VisualStudio\12.0\ComponentModelCache (Note that directory is located in Local.) Restart, if that doesn’t work then start over with step 4. From a Visual Studio Command […]
When an editor template is overridden with custom one you lose automatic scaffolding of client-side validation which uses data annotation rules. In such a case they should be added manually to your templates. In the beginning of HTML form you should add @Html.ValidationSummary(true). The parameter excludePropertyErrors = true because I don’t want to mix up error for […]
Several sets of goal criteria which help to make it clear and be achieved. Just a reference to remember. SMART S = Specific (context bound goal within defined scope of work) M = Measurable (easy way to estimate the progress) A = Assignable (someone shall be responsible for the goal) R = Realistic (the goal shall […]
If you’d like to hide WCF implementation class behind an interface to simplify future changes you should deal with some IoC. I use Autofac and have several times struggled upon the same point when trying to configure WCF to work with it. This trouble begins when you end up with failed service and message “The […]
The approach to specify DLLs in MSTest build step in TeamCity with a string pattern to be easily adopted for specific project.