Ejemplo n.º 1
0
        public void Create()
        {
            Folder = new TempFolder();
            Db     = new PetaPoco.Database(ConnectionString, "SqlServer");
            var columns = new List <string>();

            foreach (var property in typeof(T).GetProperties())
            {
                var dbType = "";
                var type   = property.PropertyType;
                if (type == typeof(int))
                {
                    dbType = "INT NOT NULL";
                }
                else if (type == typeof(string))
                {
                    dbType = "NVARCHAR(MAX) NULL";
                }
                columns.Add($"{property.Name} {dbType}");
            }
            Db.Execute($"CREATE TABLE [{typeof(T).Name}]({string.Join(", ", columns)})");
        }
Ejemplo n.º 2
0
 public TempFile(TempFolder folder)
 {
     File = Guid.NewGuid().ToString();
 }