Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public static string GetCreateTableQuery<T>(IEnumerable<T> list, string tableName)
{
Type type = typeof(T);
var properties = type.GetProperties();
var query = new StringBuilder();
query.Append($"CREATE TABLE {tableName} (");
foreach (PropertyInfo info in properties)
{
query.Append($"{info.Name} nvarchar(max),");
}
query.Append(");");
return query.ToString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment