I just downloaded and installed the latest Adventure Works database from http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=16040 to do some more playing around with LINQ and found that there are some data types that are not natively supported within Visual Studio 2008. I get the "One or more selected items ...
Why am I getting a textbox that returns undefined list of variables?
When I run this code:
var query = (from tisa in db.TA_Info_Step_Archives
where tisa.ta_Serial.ToString().StartsWith(prefixText)
select tisa.TA_Serial.ToString()).Distinct().Take(Convert.ToInt32(count));
return query.ToList...
I have this Document table with some meta data for the document in it and also the document content as a blob.
then I use lucene.Net to query my documents; which in return gives me a list of Guids to my Document table and also two fields containing the highlighted html versions of the document name and extract with the search keywords h...
Fascinating (to me) situation..
Assume my objects are in perfect working order (i.e. TDD makes me think they work).
I have a list that I create like this (except indented properly):
var result = from v in vendors
from p in v.Products
orderby p.Name
select p;
This works - I get all products from...
I have those maps in my repository.
public IQueryable<AwType> GetAwTypes()
{
return from awt in _db.AwTypes
select new AwType
{
Id = awt.Id,
Header = awt.Header,
Description = awt.Description
};
}
public IQueryable<Aw> GetAws()
{
return from aw in _db.Aws
select new Aw...
I have created some extra functionality on my Linq-to-SQL classes to make things easier as I develop my applications. For example I have defined a property that retrieves active contracts from a list of contracts. However if I try to use this property in a lambda expression or in general in a query it either throws an exception that ther...
Hi,
We are trying to build a High-Volume Orders Record System.
There are three primary tables:
1. Orders
2. OrderDetails
3. OrderShipment
The Shipment table contains n record per order and any record shipment entry can be changed before the Customer accepts th order, after which it is frozen. (A business requirement)
Although this may...
When I type 'from' (in Linq query) after improrting system.Linq namespace it is understood as a keyword; how does this magic hapen. is 'from' a extension method on some type?
...
I'm still trying to learn LINQ, though it's going more smoothly now that I've started to use it daily at work. I still don't feel good at it, though. Does anyone have any challenging practice exercises or puzzles I can use as a code-kata to improve my skills?
I'll leave this as community wiki, so maybe it can grow to a community list.
...
I have a table, we'll call Users. This table has a single primary key defined in SQL Server - an autoincrement int ID.
Sometimes, my LINQ queries against this table fail with an "Index was outside the range" error - even the most simplest of queries. The query itself doesn't use any indexers.
For example:
User = Users.Take(1);
o...
If I have the following Linq code:
context.Table1s.InsertOnSubmit(t);
context.Table1s.InsertOnSubmit(t2);
context.Table1s.InsertOnSubmit(t3);
context.SubmitChanges();
And I get a database error due to the 2nd insert, Linq throws an exception that there was an error. But, is there a way to find out that it was the 2nd insert that had...
What would be the best method to implement extra functionality in a database layer that uses Linq-to-SQL? Currently I'm looking at implementing functions for adding information based on presets and similar tasks?
Inserts, updates and deletes requires access to the DataContext and in the Table classes you don't have access to the context...
Is LINQ a kind of Object-Relational Mapper?
...
In a related question, my team is about to (hopefully) start using LINQ, and I'd like to take advantage of anonymous types. What is the best way to mix VB.NET's Option Strict (which we've been using through the life of the project) and the new Option Infer directives?
...
I'm trying to think of clever, clear, and simple ways to write code that describes the sequence of integers in a given range.
Here's an example:
IEnumerable<int> EnumerateIntegerRange(int from, int to)
{
for (int i = from; i <= to; i++)
{
yield return i;
}
}
...
Is there any smart way to do this?
If using Linq2Nhibernate, you really seem to have to rely on HQL or the likes to do multiple deletes from a database (without loading up and deleting one by one)?
It doesn't seem like Linq2Sql have it either? I just want something that can do stuff like:
DELETE FROM Accounts WHERE amount < 1000
Any...
I have a ASP.Net page using ADO to query MS access database and as a learning exercise i would like to incorporate LINQ. I have one simple table called Quotes.
The fields are: QuoteID, QuoteDescription, QuoteAuthor, QuoteDate. I would like to run simple queries like, "Give me all quotes after 1995".
How would i incorporate LINQ int...
Hey all.
I got one big question.
I got a linq query to put it simply looks like this:
from xx in table
where xx.uid.ToString().Contains(string[])
select xx
The values of the string[] array would be numbers like (1,45,20,10,etc...)
the Default for .Contains is .Contains(string).
I need it to do this instead: .Contains(string[])......
I've got some LINQ to SQL that sometimes throws a
"Cannot insert duplicate key row in object 'dbo.Table' with unique index
'IX_Indexname'.The statement has been terminated."
Is there some way I can turn on logging or at least debug into the datacontext to see what sql is being executed at the time that error is raised?
Update: ...
I came across this class while reading a C# book and have some questions.
Why is this added into System.Linq namespace and not into usuall Collections namespace?
What the intention behind this class is
Why this class is not intended for direct instantiation? This is available through the ToLookup extension only, right?
...