Skip to content

Commit 560c6e5

Browse files
committed
add mysql dialect
1 parent aac6ec9 commit 560c6e5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Dapper.SimpleCRUD/SimpleCRUD.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ public static void SetDialect(Dialect dialect)
5454
_getIdentitySql = string.Format("SELECT LAST_INSERT_ROWID() AS id");
5555
_getPagedListSql = "Select {SelectColumns} from {TableName} {WhereClause} Order By {OrderBy} LIMIT {RowsPerPage} OFFSET (({PageNumber}-1) * {RowsPerPage})";
5656
break;
57+
case Dialect.MySQL:
58+
_dialect = Dialect.MySQL;
59+
_encapsulation = "`{0}`";
60+
_getIdentitySql = string.Format("SELECT LAST_INSERT_ID() AS id");
61+
_getPagedListSql = "Select {SelectColumns} from {TableName} {WhereClause} Order By {OrderBy} LIMIT {RowsPerPage} OFFSET (({PageNumber}-1) * {RowsPerPage})";
62+
break;
5763
default:
5864
_dialect = Dialect.SQLServer;
5965
_encapsulation = "[{0}]";
@@ -777,7 +783,8 @@ public enum Dialect
777783
{
778784
SQLServer,
779785
PostgreSQL,
780-
SQLite
786+
SQLite,
787+
MySQL,
781788
}
782789

783790
}
@@ -920,4 +927,4 @@ public static bool IsSimpleType(this Type type)
920927
};
921928
return simpleTypes.Contains(type) || type.IsEnum;
922929
}
923-
}
930+
}

0 commit comments

Comments
 (0)