Entity Framework LINQ Query using Custom C# Class Method - Once yes, once no - because executing on the client or in SQL?

I think your better of using a Model Defined Function here Define a scalar function in your database which returns a DateTime pass through whatever you need, map it on your model, then use it in your LINQ query: from g in oc.Users. Where(u => u. Aspnet_User.

UserName == fbaUsername).First(). Groups from d in g. Discussions select new { UnReadPostCount = d.Posts.

Where(p => p. CreatedDate > myFunkyModelFunction(fbaUsername, p. Discussion)).Count() }.

I think your better of using a Model Defined Function here. Define a scalar function in your database which returns a DateTime, pass through whatever you need, map it on your model, then use it in your LINQ query: from g in oc.Users. Where(u => u.

Aspnet_User. UserName == fbaUsername).First(). Groups from d in g.

Discussions select new { UnReadPostCount = d.Posts. Where(p => p. CreatedDate > myFunkyModelFunction(fbaUsername, p.

Discussion)).Count() }.

And most importantly if there's a way to factor common query syntax like what's in the GetLastReadToDate() method into a separate location to be reused in several different places LINQ queries. A stored procedure would probably be one way to store that 'common query syntax"...EF, at least 4.0, works very nicely with SP's.

UnReadPostCount = d.Posts. Where(p => p. CreatedDate > DiscussionRepository.

From d in oc. UnReadPostCount = d.Posts. Where(p => p.

CreatedDate > DiscussionRepository. LINQ to Entities does not recognize the method 'System. String, Discussion)' method, and this method cannot be translated into a store expression.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions