c# - LINQ to Entities to replace a join to a generated table -


I have some SQL that I want to repeat LINQ to the unit. It has a datetime column and a table with GPS location at that time for another unit in the system. This ladder combines this table for the output of a table that generates a "time table" during a particular period. The code for this TVF looks something like this:

  WHILE @ dt_start & lt; = @ Dt_end BEGIN enter @res (dt) VALUES (@dt_start) SET @dt_start = dateadd (ms, @interval_ms, @tt_state) end - when  

then the result is cross Added, for each unit generated for a list of GMS locations, dt_start to Dt_end for the unit.

My ethical effort looks like a simple test to repeat this functionality:

  var times = new list & lt; DateTime & gt; {DateTime.Parse ("2009-04-04"), DateTime Pars ("2009-04-05"}}. Enqueble (); Var query = GPS in GB. Datapoincetset from time to time where gps.Driver.Id = = 1 & amp; amp; Gps.UtcTime & lt; = GPS by gps.Driver.Id choose T-group GPS ggps.OrderByDescending (GPS => GPS.ID); var test = query.ToList (); < / Code> 

But obviously this does not work - I include it in the hope that it can give you a vague idea of ​​what I am trying to achieve here. Does anyone have any suggestions on how I can copy TVF functionality in LINF to Entity queries, without it too much disabled?

If you want to create a set of time from a start time from a start time, try doing something like this.

Public IEnumerable & lt; date time & gt; interval (date time start, date timeout, interval interval) {int number = (int) ((end-end B). Total Emilicand / Interval MS); Return numerical Category (0, number). Select (i = & gt; get started + timespace from milliseconds (interval ms * i)); }

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -