public virtual DbTypeDef AddDbTypeDef(string name, Type columnOutType, DbTypeFlags flags = DbTypeFlags.None, string specTemplate = null, string aliases = null, byte?defaultPrecision = null, byte?defaultScale = null, ToLiteralFunc toLiteral = null, string columnInit = null, bool mapColumnType = true, //map to column out type if typeDef has no args and not unlimited object providerDbType = null, //used by Postgres only DbSpecialType specialType = DbSpecialType.None) { var arrAliases = string.IsNullOrEmpty(aliases) ? _emptyStrings : aliases.Split(','); toLiteral = toLiteral ?? DbValueToLiteralConverters.GetDefaultToLiteralConverter(columnOutType); columnInit = columnInit ?? GetDefaultColumnInitExpression(columnOutType); var typeDef = new DbTypeDef() { Name = name, ColumnOutType = columnOutType, Flags = flags, Aliases = arrAliases, ToLiteral = toLiteral, ColumnInit = columnInit, DefaultPrecision = defaultPrecision, DefaultScale = defaultScale }; TypeDefsByName.Add(name, typeDef); // register under aliases foreach (var alias in typeDef.Aliases) { TypeDefsByName.Add(alias, typeDef); } if (specialType != DbSpecialType.None) { Util.Check(!SpecialTypeDefs.ContainsKey(specialType), "TypeDef for special type {0} already registered.", specialType); SpecialTypeDefs[specialType] = typeDef; } // Register by columnOutType if (!TypeDefsByColumnOutType.ContainsKey(columnOutType)) { TypeDefsByColumnOutType[columnOutType] = typeDef; } // If has a form without args, register it as default type def if (!flags.IsSet(DbTypeFlags.HasArgs)) { typeDef.DefaultTypeInfo = CreateDbTypeInfo(columnOutType, typeDef); if (mapColumnType && !flags.IsSet(DbTypeFlags.Unlimited) && !DbTypesByClrType.ContainsKey(columnOutType)) { DbTypesByClrType[columnOutType] = typeDef.DefaultTypeInfo; } } if (providerDbType != null) { typeDef.ProviderDbType = (int)providerDbType; } return(typeDef); }