I have to perform the following SQL query:
select answer_nbr, count(distinct user_nbr)
from tpoll_answer
where poll_nbr = 16
group by answer_nbr
The LINQ to SQL query
from a in tpoll_answer
where a.poll_nbr = 16 select a.answer_nbr, a.user_nbr distinct
maps to the following SQL query:
select distinct answer_nbr, distinct user_n...
Is there a limit to the rows that IEnumerable.Count() (or IQueryable.Count()) using LINQ to SQL? For whatever reason, if my query returns more than 200 records, I only get 200 from IEnumerable.Count(). I've even tried using IEnumerable.LongCount() (even though the number of results shouldn't be high enough to need it). I've also verif...
We moved the .dbml file out of the website and into another assembly so it could be shared across multiple applications. The problem is that now I'm getting an error that doesn't make any sense.
The basic query is like this:
from D in Devices
select new
{
EquipmentTypeID = D.DMXDeviceModel.DMXDeviceClass.DMXEquipmentType.ID,
/...
It's not that I can't google for myself, however others have tread this path before me and I"m always interested in what other programmers have found helpful, or not :)
Thanks in advance for any input.
...
Can SQL Server 2000 be used as the database for LINQ to SQL?
Does LINQ to SQL rely on a specific version of Microsoft SQL Server?
...
I am using LinqToSQL to grab data from my database.
I am injecting my DBContext into the application using Springs IOC container.
If I dont have my VS debugger attached, it works fine.
However, with the debugger attached I get the following errors:
"There is already an open DataReader associated with this Command which must be closed...
Can you return IQueryable which is composed of two or more different subclasses ? Here's my attempt to show what I mean. It throws the error:
System.NotSupportedException: Types in
Union or Concat have members assigned
in different order..
var a = from oi in db.OrderItems
where oi.OrderID == ID
&& oi.ListingID != n...
Hi,
in my data layer class I have created a function to manually refresh the data source.
Public Sub DiscardAllChanges()
_Context.Refresh(RefreshMode.OverwriteCurrentValues)
End Sub
The problem is that the context ChangeSet after this operation still trace the previous operation of Insertion, Deletion and Update that I made call...
I've been reading about how Linq to SQL is dead (link here).
So my question is what should I use instead? I already have a project full of Linq to SQL. What's the best thing to migrate it over to?
...
I'd like the community's take on some thoughts I've had about Linq to Sql and other ORM mappers.
I like Linq to Sql and the idea of expressing data access logic (or CRUD operations in general) in your native development tongue rather than having to deal with the "impedance mismatch" between C# and SQL. For example, to return an ObjectD...
The number of query conditions is determined by user selections at runtime, ie
var results= from r in db.Table
where condition A && condition B && ... condition XX...
Is the best way to handle this to build a string variable and append to it or is there another way?
...
hello all,
I'm working with linq to sql, and therefore need to store my DataContext for future use for each thread (I've read this article: http://www.west-wind.com/weblog/posts/246222.aspx
regarding ways to implement a shared context). What I want to know though, is how do I create a single key that both the global.asax file will know...
Here is my scenario:
I have implemented set logic in my C# framework. Sets can contain a large quantity of objects, perhaps even up to 1 million in the worse case. Assume sets just contain lists of objects called Doc. Because of the potential large number of objects, I would like to give the developer a choice of how to create and us...
Hey all,
I am working with another coder on a website that is accessing SQL Server (2008 Express) through some web services he created (involving mostly LINQ to SQL), and the UI is in Silverlight. I've been working on another part of the system, but just got his latest code, and am trying to run it on my machine, but am getting an erro...
Ok, I have managed to get the following working
public IQueryable getTicketInformation(int ticketID)
{
var ticketDetails = from tickets in _context.tickets
join file in _context.file_objects on tickets.ticket_id equals file.source_id
where tickets.ticket_id == ticketID
select new { tickets.ticket_id, tickets....
I feel like I'm running around in circles. I can't seem to make up my mind as to what the right Repository pattern is using Linq To Sql. If you're familiar with Rob Conery's MVC Storefront you will see that his implementation wraps the Linq-Generated models with another class and treats the Linq-Generated one simply as a Data Transfer Ob...
I have a question regarding the integration of business objects developed using Linq To Sql for data query and integrating with Sql Server Reporting Services.
We have a set of business objects that query a couple of back end databases that is developed with Linq to SQL. The SQL that gets generated is relatively dynamic (based on the con...
I have two tables 1) Product 2) Categories
Product table has a field called "CategoryID" and the Category table has a field called "CategoryName", ID, DateCreated, and a few others.
I want to use LINQ to SQL to query all the Product rows as well as JUST the Category.CategoryName. This query will be used in a datasource and be bound to ...
I have a hierarchy that I'd like to query with LinqToSql:
Country -> Region -> City -> ZipCode
Each entity holds both a reference to it's parent (eg. Region.Country) and a collection of it's children (eg. Region.Cities).
I'd like to eager load each entity's parent along with Countries and Regions but lazy load cities and zip codes.
T...
query = query.Where(m => m.People.Contains(s)).Select(m => m).ToList();
In the above, "People" is an IList of strings. IF I replace People with a list of objects with string as a field of that object, how do I get the same results.
...