Industry Insights from Our Experts

Monthly Archives: May 2013

Automapper Review

Comments Off
Filed under .NET, Productivity, Software Architecture

Automapper is a great tool we used in a recent project for mapping objects.  With the tiered architecture we used, we ended up with and MVC front end, and a web service back end.  This meant that there were web service objects and MVC models that had essentially the same structures, but .NET does not implicitely realize this.  What this often causes is code that looks like this:

person.FirstName = Webservice.Person.FirstName;
person.LastName = Webservice.Person.LastName;
person.Birthdate = Webservice.Person.Birthdate;
person.Address = Webservice.Person.Address;
person.PhoneNumber = Webservice.Person.PhoneNumber;
person.Gender = Webservice.Person.Gender;

We’ve all seen this code and to the human eye it looks repetitive, but to a machine it is necessary.  This is where automapper comes in.  It simplifies this process and turns the above code into this:

person = PersonMapper.Map(Webservice.Person);

Having your objects sharing identical field names makes your life a lot easier.  You can install Automapper from NuGet and have it working right away.  Just create a new class and include the automapper library..  Your method signature will look something like this:

public static Models.Person Map(MemberServices.Person person)
   return Mapper.Map(person);

That’s it!  You can call your .Map function from now on and Automapper will handle the rest.


This is of course a very simple example that all Automapper can do for you.  In the case where you do not have identically named fields, you can configure Automapper to map to fields of different names.  You’re also able to map entire arrays if need be to save yourself work on those redundant copy loops.


For more information on AutoMapper and to get started, click here


A Real Live Hybrid Mobile App

Comments Off
Filed under JavaScript

Developers love to discuss hybrid vs. native apps. I’ll cover the basic argument briefly, but the point of this post is to go over some specific real-life problems that I had to solve.

Native vs. Hybrid

"Native app" refers to code compiled into binaries native to the platform. A "hybrid app," by contrast, consists of an app written using JavaScript / CSS / and HTML running in a browser component (WebView on Android, UIWebView on iOS) supplied by a wrapper native app.

The theoretical advantage of a mobile app is that you only have to write it once and it will run on all platforms, at the cost of the performance hit incurred by doing everything in JavaScript. In practice, things are not that simple.

Read More »

Copyright 2018 by Quercus Solutions