public override string GetPropertyTypeName(string dbTypeName) { dbTypeName = dbTypeName.ToLower(); var propertyTypes = MappingTypes.Where(it => it.Value.ToString().ToLower() == dbTypeName || it.Key.ToLower() == dbTypeName); if (propertyTypes == null) { return("other"); } else if (dbTypeName == "xml" || dbTypeName == "string" || dbTypeName == "jsonb" || dbTypeName == "json") { return("string"); } else if (dbTypeName == "bpchar") //数据库char datatype 查询出来的时候是 bpchar { return("char"); } if (dbTypeName == "byte[]") { return("byte[]"); } else if (propertyTypes == null || propertyTypes.Count() == 0) { Check.ThrowNotSupportedException(string.Format(" \"{0}\" Type NotSupported, DbBindProvider.GetPropertyTypeName error.", dbTypeName)); return(null); } else if (propertyTypes.First().Value == CSharpDataType.byteArray) { return("byte[]"); } else { return(propertyTypes.First().Value.ToString()); } }
public override string GetPropertyTypeName(string dbTypeName) { dbTypeName = dbTypeName.ToLower(); var propertyTypes = MappingTypes.Where(it => it.Value.ToString() == dbTypeName || it.Key.ToLower() == dbTypeName); if (dbTypeName == "int32") { return("int"); } else if (dbTypeName == "int64") { return("long"); } else if (dbTypeName == "int16") { return("short"); } else if (propertyTypes == null) { return("other"); } else if (dbTypeName == "xml" || dbTypeName == "string") { return("string"); } if (dbTypeName == "byte[]") { return("byte[]"); } else if (propertyTypes == null || propertyTypes.Count() == 0) { //Check.ThrowNotSupportedException(string.Format(" \"{0}\" Type NotSupported, DbBindProvider.GetPropertyTypeName error.", dbTypeName)); throw new NotSupportedException($"{ dbTypeName } Type NotSupported, DbBindProvider.GetPropertyTypeName error"); } else if (propertyTypes.First().Value == CSharpDataType.byteArray) { return("byte[]"); } else { return(propertyTypes.First().Value.ToString()); } }