Last active
April 30, 2018 09:15
-
-
Save DaniCCardenas/e5730a59f98b58eb2010cfe3618bdd59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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