From 2d63ac857ed1082f6f7d365674aa734c582a99dd Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 5 Dec 2022 09:02:50 +0800 Subject: Develop secret api. v6 --- .../CrupestApi.Commons/Crud/CrudService.cs | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudService.cs') diff --git a/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudService.cs b/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudService.cs index d5edd13..bc4ed50 100644 --- a/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudService.cs +++ b/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudService.cs @@ -60,30 +60,15 @@ public class CrudService } } - public string GetDatabaseTypeName(Type type) + public string GetSqlType(Type type) { - if (type == typeof(int)) - { - return "INTEGER"; - } - else if (type == typeof(double)) - { - return "REAL"; - } - else if (type == typeof(bool)) - { - return "BOOLEAN"; - } - else - { - throw new DatabaseInternalException($"Type {type} is not supported."); - } + return ColumnTypeInfoRegistry.Singleton.GetSqlType(type); } public string GetCreateTableColumnSql() { var properties = typeof(TEntity).GetProperties(); - var sql = string.Join(", ", properties.Select(p => $"{p.Name} {GetDatabaseTypeName(p.PropertyType)}")); + var sql = string.Join(", ", properties.Select(p => $"{p.Name} {GetSqlType(p.PropertyType)}")); return sql; } -- cgit v1.2.3