allow persistence.factory in options to be string
support case insenstive persistence string
1) refactor code; 2) fail with Error object instead of string
Merge pull request #171 from mocheng/fix_126

allow persistence.factory in options to be string