I'm using LINQ to DB (linq2db, linq2db.EntityFrameworkCore) and want to use "select into" clause to create new table from query.
Something like this:
SELECT * INTO #TempTable FROM SourceTable
My classes:
public class TempTable {
public long Id { get; set; }
public DateTime TimeStamp { get; set; }
public string TypeName { get; set; }
public string TypeAbbr { get; set; }
public static Expression<Func<SourceTable, TempTable>> CloneSourceTable => obj => new TempTable{...};
}
public class SourceTable {
public long Id { get; set; }
public DateTime TimeStamp { get; set; }
public string TypeName { get; set; }
public string TypeAbbr { get; set; }
public string OwnerTitle { get; set; }
}
How can this be done using ling2db?
UPD If manually create a temporary table, then I can use code like this to copy the data:
Db.SourceTable.Insert(Db.TempTable.ToLinqToDBTable(), TempTable.CloneSourceTable());
But I'd like to create TempTable (#TempTable) via linq2db as a complete copy of SourceTable, rather than doing it manually.