Let us assume that we have the following simple task: Given a Dictionary, convert that dictionary into a type in as performant a manner as possible. The conversion will happen many time, and first time costs are acceptable. The answer we came up with is to dynamically generate the code based on the type. Basically, here is how it looks like: public static Func, T> Generate()
where T : new()
var dic = Expression.Parameter(typeof (Dictionary), "dic");
var tmpVal = Expression.Parameter(typeof (string), "tmp");
= new List();
foreach (var propertyInfo in typeof(T).GetProperties())
var tryGet = Expression.Call(dic, "TryGetValue", new Type,
Expression value = tmpVal;
if (propertyInfo.PropertyType != typeof (string))
var convertCall = Expression.Call(typeof(Convert).GetMethod("ChangeType",...(Read whole news on source site)
Some of the biggest challenges when testing software can be getting the software into some very specific states. You want to test that the new error message works, but this message is only shown when something on the back-end breaks and the back-end has never broken before because it always “just works”. Maybe the software you have to test is powered by other people’s data, data that you have no direct control over and you really need to manipulate this data in order to perform your tests.
Imagine you are testing a piece of software which displays the names of local
businesses as values as a drop-down list.
This software might look something like this…
There are only three items on this list at the moment, but this may not always be the case.
There is currently no option within the software itself to change or manipulate the text displayed on the list because the software retrieves this list of data from someone else’s API. We have no control over the data returned by the API, our software under test just displays it.
You have been asked to test the drop-down box. What would you do?
Well most testers would start by looking at it. It...(Read whole news on source site)
Sometime we need to find out details of running process which is external to your current process, might be a third party one. If you are currently looking for some code to find out details of a process, this post will definitely help you. Here we will learn, how to get the process description using C#. Continue reading to learn about it. Also, sample code has been shared for you to understand it better. If you have specific query, drop a line in the comment section.
you open the Task Manager in your Windows system and navigate to the details tab, as shown below, you will find out the various process names running in your system. This includes the name of the process, the process ID (aka. PID), status of the process and the description. If you are a developer and looking for an way to retrieve using C#, the “Process” instance doesn’t return this information. To do this, we need to iterate thru the Win32_Process
using the ManagementObjectSearcher
. Normal SQL like query “Select...(Read whole news on source site)
In this third article of the exploring SQL Server 2016 Always Encrypted series, Greg Larsen looks at the differences between an Always Encrypted column that uses an encryption type of Deterministic and those that use encryption type of Randomized.
A proposed solution to the INSERT EXEC problem in tSQLt
Learn the essentials for working with Xamarin Designer.
I just shipped a new version of Heroic.AutoMapper
. Unfortunately, AutoMapper 4.2.0 introduces some breaking changes between 4.1.0 (semvar, anyone?), and Heroic.AutoMapper was impacted. That means anything that uses Heroic.AutoMapper is also impacted. Fortunately, the change is mechanical, and a NuGet package update followed by some find-and-replace should have you back up and running. First, update to Heroic.AutoMapper 2.0.0. Next, do a find-and-replace, replacing “CreateMappings(IConfiguration” with “CreateMappings(IMapperConfiguration”. Any type that implements IHaveCustomMappings should have changed from this:public void CreateMappings(IConfiguration configuration)
.ForMember(x => x.Name, opt
=> opt.MapFrom(x => x.FullName));
To this:public void CreateMappings(IMapperConfiguration configuration)
.ForMember(x => x.Name, opt => opt.MapFrom(x => x.FullName));
Going forward, AutoMapper 5.0 is going to be a big change. I’m still not sure how I feel about it. On the one hand, I totally agree that having a non-static version of Mapper could be useful, and it will probably clean up a lot of things internally. But, in every application I’ve ever created, I’ve only ever needed a single Mapper. I can’t think of a single time I’ve needed a...(Read whole news on source site)
Sometimes it is needed to connect to SQL Server using System account. Don’t literally ask me if this is a valid scenario in first place. Someone just pinged to say – they want to do it. I was personally not sure why, but they had their own internal requirement to do the same. It is […]