moving code from codeplex
Merge https://github.com/tiagodll/dNet.DB