Skip to Content

Temporary Tables

Linqer supports Temporary Tables conversion.

For example, the SQL below

declare @Cities TABLE (City varchar(40), Country varchar(10))

insert into @Cities(City,Country) values('London','UK')

insert into @Cities(City,Country) values('Seattle','USA')

SELECT C.*, E.FirstName, E.LastName FROM Employees E JOIN @Cities C ON E.City = C.City

can be converted to LINQ

from E in db.Employees.ToList()

join C in Cities on E.City equals C.City

select new {

City = C.City,

Country = C.Country,

E.FirstName,

E.LastName

}

Linqer also provides temporary table definition in the LINQ Classes window.

public class Cities_record

{

public string City;

public string Country;

}

public class Cities_table : List<Cities_record>

{

}

Data for this temporary table is provided in LINQ Code window

Cities_table Cities = new Cities_table();

Cities_record iCities = new Cities_record

{

City = "London",

Country = "UK"

};

Cities.Add(iCities);

iCities = new Cities_record

{

City = "Seattle",

Country = "USA"

};

Cities.Add(iCities);