If you have to call one of your own methods in an IQueryable to the database, and you can't replace it with one of the DbFunctions<http://msdn.microsoft.com/en-us/library/system.data.entity.dbfunctions(v=vs.113).aspx>methods, then do an AsEnumerable() and you can do whatever you like on the local collection (assuming it's a reasonable size). This also avoids making an intermediate List<> -- Greg
On 19 May 2014 22:10, David Rhys Jones <djones...@gmail.com> wrote: > Hi, > you can't use local functions in a database query, > your query would look like this, Select IssueId, IssueTitle, EtaDate = > ?????? from vwIssues. > > get all the data from the database with a .ToList(); > > then loop over the collection and call the method, you could even do this > with a parallel loop. > > Parallel.ForEach( issues, x => x.EtaDate = NodaTimeUtil. > ConvertToMelbourneTimeZoneFromUtc(x.ETADate.Value)); > > Davy. > > Davy, > > "So you want to keep data which is local, only ever going to be local, > only needed locally, never accessed remotely, not WANTED to be made > available outside our building, which can only WEAKEN our security by being > off site, hosted offsite." BOFH: Simon Travaglia > > > > > On Mon, May 19, 2014 at 1:38 PM, <anthonyatsmall...@mail.com> wrote: > >> >> >> var issues = from n in db.vwIssues >> >> where n.IsDeleted == false & n.Archived == false >> >> orderby n.ETADate descending,n.PriorityOrder >> ascending, n.DateModified descending >> >> select new IssueViewModel >> >> { >> >> IssueId = n.IssueId, >> >> IssueTitle = n.IssueTitle, >> >> ETADate = >> NodaTimeUtil.ConvertToMelbourneTimeZoneFromUtc(n.ETADate.Value), //doesn't >> like it >> >> Status = n.StatusName, >> >> }; >> >> >> >> >> >> How do i achieve the above requirement, ie change date to local time as >> date >> in db is UTC >> >> >> >> >> >> Anthony Salerno | Founder | SmallBiz Australia >> Innovation | Web | Software | Developers | Support >> +613 8400 4191 | 2Anthony (at) smallbiz.com.au | Po Box 135, Lower >> Plenty >> 3093 ABN : 16 079 706 737 >> >> www.smallbiz.com.au <http://www.smallbiz.com.au/> | >> www.linkedin.com/in/innovativetechnology >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >