public static HStore Create(string value) { var matches = HstoreKeyPairMatch.Matches(value); var hstore = new HStore(); foreach (Match match in matches) { string key = match.Groups[1].Value; string val = match.Groups[2].Value; key = KeyReg2.Replace(KeyReg.Replace(key, "$1"), "$1"); val = val.ToUpper() == "NULL" ? null : KeyReg2.Replace(KeyReg.Replace(val, "$1"), "$1"); hstore.Add(key, val); } return(hstore); }
public override Func <object, object> GetFromDbConverter(Type destType, Type sourceType) { if (destType == typeof(DateTimeOffset) || destType == typeof(DateTimeOffset?) || destType == typeof(DateTime) || destType == typeof(DateTime?)) { return(x => this.GetFromDbConverter(x, destType, sourceType)); } if (destType == typeof(HStore) && sourceType == typeof(string)) { return(x => HStore.Create((string)x)); } return(base.GetFromDbConverter(destType, sourceType)); }