I have a string in the format:
MyList.Where(abc).GroupBy(def).Sum(ghi)
The Where & GroupBy parts are optional as is the argument to the function, so.
ThisList.Count
is also valid.
I'm trying to find a RegEx string that will match this and return the values:
The List name (e.g. MyList), the where condition (e.g. abc), the GroupBy a...
I have a timestamp (rowversion) column (called t_stamp) in my tables. I use EF4 as my ORM. I see that the timestamp fields become byte[] properties on my objects.
I want to use LINQ something like this:
byte[] last = 0x00782342
from o in _db.Objects
where o.t_stamp > last
select o
But that doesn't work because I can't use > on a byt...
I've this linq to devforce expression :
(from r in mgr.testTables select r).OrderBy(r => r.id);
I want to specify sorting column name as a string, I need something like this :
string orderBy = "r => r.id";
(from r in mgr.testTables select r).OrderBy( orderBy );
is there any way to parse a string as linq expression ?
...
I'm trying to do something like this:
List<FundEntity> entities = this.tFunds
.Select(f => new FundEntity() {
ID = f.fundID,
Name = f.name,
CapitalCalls = f.tCapitalCalls
.Select(cc => new CapitalCall() {
ID = cc.capitalCallID,
...
I am using Linq-To-Sql to populate my business layer. Here is a snippet of a query I am working on:
fund.FundEntities = fundGroup.tFunds
.Select(fe =>
{
var fundEntity = new FundEntity()
{
BankAccount = null,
CloseDate = fe.closeDate ?? new DateTime(),
Commitment = fe.commitmen...
Every man and his dog seems to be adding an implementation of LINQ to something.
http://linqtotwitter.codeplex.com/
http://blogs.msdn.com/b/aconrad/archive/2007/12/10/linq-to-rest.aspx
http://linqtowikipedia.codeplex.com/
http://www.codeproject.com/KB/linq/LINQtoCSV.aspx
http://mhinze.com/linq-to-nhibernate-in-10-minutes/
it's even b...
Building an application with a database that has the ability to get big not HUGE but definate big tables with a million records +. I just saw somewhere that LINQ isn't good for Big Datbases.
Front end will be in Silverlight and I was really looking forward to using its Skip and Take functionality for the Asynchronous calls to speed u...
I have a fairly complex LINQ to Entities query I'd like to try compiling because it's a bit slower than I'd like.
I build it in a series of steps though. Here's a simple example:
public static List<Employee> GetEmployees(EntityContext ctx, bool showTerminated)
{
var q = ctx.Employees;
if(showTerminated==false)
{
q ...
I have a hard time telling what operations in linq cause a SQL command to be issued to the database.
I know calling ToList() or iterating w/ foreach will cause the query to run but do Select and GroupBy cause the code to execute on the database?
...
Hello,
I have a specialized string dictionary of (string, string) (_RulesAndTheirDescriptions) that contains the name (key) and description (value) of methods in a given class. I currently do the following query to search for a match on the key or value and then bind that to a grid. Works great!
Dim Results = From v In _RulesAndThe...
Hi
I'm getting into LinqToSql and using the NerdDinner tutorial.
I'm trying to understand the syntax and would like to write out in more verbose fashion what is happening in the first line, which works.
Question: How can I write the first query something like the commented out code (which doesn't work).
public Dinner GetDinner(int...
I'm trying to subgroup a group using linq. This is proving to be more difficult than I thought. So far I took a quick and dirty approach but it's not as efficient as I would like. Can these two linq statements be simplified into one?:
var basketBalls = from Ball ball in Balls
where ball.IsBasketBall())
...
I thought this would have been quite common but can't find anything on this. I'm trying to query columns that have spaces immbedded within them. For the life of me I don't see a way of selecting them when I'm trying to assign them to an alias when creating an anonymous type result. Here's the code, but not sure how to go from here:
D...
I've written a custom LINQ extension method that extends the TakeWhile() method to be inclusive, rather than exclusive when the predicate is false.
public static IEnumerable<T> TakeWhile<T>(this IEnumerable<T> source, Func<T, bool> predicate, bool inclusive)
{
source.ThrowIfNull("source");
predica...
Hi!
I'm working on an application where a lot of data is inserted into an SQL database at once. I use LINQ to SQL, and have something like this as my insert operation:
foreach (var obj in objects)
{
context.InsertOnSubmit(obj);
}
context.SubmitChanges();
Here's the problem: If I get an exception (for instance, DuplicateKeyException),...
Is it possible to generate the following SQL query by using LINQ-to-SQL query expression or method chains which is defer-executable?
Data Structure
Select Distinct ClassRoomTitle,
Count(*) Over(Partition By ClassRoomNo) As [No Sessions Per Room],
TeacherName,
Count(*) Over(Partiti...
The error message I receive is:
At least one object must implement IComparable
The code causing this is below:
private static IEnumerable<Result> setOrderBy(IEnumerable<Result> value, string order)
{
if (order.Equals("ASC"))
{
//value = value.OrderBy(c => c, new SearchService.ResultComparer<Attribute>());
value...
If I have a set of employee data similar to:
var users = new[]
{
new {SupervisorId = "CEO", UserId = "CEO", UserName = "Joe"},
new {SupervisorId = "CEO", UserId = "CIO", UserName = "Mary"},
new {SupervisorId = "CIO", UserId = "XDIR", UserName = "Ed"},
new {SupervisorId = "...
from x in myCollection
group x by x.Id into y
select new {
Id = y.Key,
Quantity = y.Sum(x => x.Quantity)
};
How would you write the above as a lambda expression? I'm stuck on the group into part.
...
I have a query:
from m in dc.ReportingMonths
where m.Month.Value == month
select (from k in m.KPI_Actives
where k.DateActive.Year == year
select (from r in dc.ReportingViews
where r.KPIID == k.KPIID select r)
);
Obviously, because it is nested LINQ queries - each returning an IQueryable I get a s...