Create temporary table with Entity Framework

I want to create a temporary table in sql server using Entity Framework. Is there any way to do this? If I can create a temporary table, my next question is: how can I read it?

Thanks in advance.

Andre

+4
source share
1 answer

Okay, so you don’t like the route of the stored procedures .... and I'm not honest, but this is the fastest way I could do this.

Based on this, I do not know what an easy way to create temporary tables in EDM, so my next suggestion would be to create local objects that mimic the temporary table that you want to create. The temporary name, obviously, indicates that you do not want them to reside permanently in the database, so using memory objects has much more controllability and (depending on your delay) is faster than making several calls in the database.

public class MyTempTable { public string ID { get; set; } public string Column1 { get; set; } // your other columns here } List<MyTempTable> tempTable = new List<MyTempTable>(); 

Once you have created your list of objects, you can basically do everything that you usually do in the database table using Linq.

+1
source

Source: https://habr.com/ru/post/1487438/


All Articles