Last year, Scott Guthrie stated “You can actually override the raw SQL that LINQ to SQL uses if you want absolute control over the SQL executed”, but I can’t find documentation describing an extensibility method.
I would like to modify the following LINQ to SQL query:
using (NorthwindContext northwind = new NorthwindContext ()) {
v...
Hello,
A project I'm working on at the moment involves refactoring a C# Com Object which serves as a database access layer to some Sql 2005 databases.
The author of the existent code has built all the sql queries manually using a string and many if-statements to construct the fairly complex sql statement (~10 joins, >10 sub selects, ~1...
Have been trying out the new Dynamic Data site create tool that shipped with .NET 3.5. The tool uses LINQ Datasources to get the data from the database using a .dmbl context file for a reference. I am interseted in customizing a data grid but I need to show data from more than one table. Does anyone know how to do this using the LINQ D...
In the ContainsIngredients method in the following code, is it possible to cache the p.Ingredients value instead of explicitly referencing it several times? This is a fairly trivial example that I just cooked up for illustrative purposes, but the code I'm working on references values deep inside p eg. p.InnerObject.ExpensiveMethod().Val...
I'm designing my database and LINQ To SQL ASP.NET web application.
Imagine I have two types of pages: normal and root. Some pages are roots. Some pages are not.
I have a Page database table and a RootPage database table:
Page
----
PK PageId
HtmlTitle
PageHeading
MetaDescription
IsRoot
R...
There are so many different options coming out of microsoft for data access. Which one is the best for scalable apps?
Linq
Should we be using Linq? It certainly seems easy but if you know your SQL does it really help. Also I hear that you can't run Async queries in ASP.NET using Linq. Therefore I wonder if it is really scalable? Are th...
Hi, I have something that is driving me absolutely crazy...
Public Function GetAccountGroups() As IList(Of AccountGroup)
Dim raw_account_groups As IList(Of AccountGroup)
raw_account_groups = _repository.GetAccountGroups().ToList()
Dim parents = (From ag In raw_account_groups _
Where ag.p...
Hi,
Another easy one hopefully.
Let's say I have a collection like this:
List<DateTime> allDates;
I want to turn that into
List<List<DateTime>> dividedDates;
where each List in 'dividedDates' contains all of the dates in 'allDates' that belong to a distinct year.
Is there a bit of LINQ trickery that my tired mind can't pick out...
When using Linq to SQL with stored procedures, what is the best way to re-generate the C# code generated by Visual Studio?
For example, when adding a column to your SP's result set and need to have Visual Studio re-create the class describing the result set, I'd expect to open the DBML designer, right-click the SP in question, and sel...
Is there a good way to time SQL queries when using Linq to SQL? I really like logging feature, but it would be great if you could somehow also time that query. Any ideas?
...
Hi all,
I have recently written an application(vb.net) that stores and allows searching for old council plans.
Now while the application works well, the other day I was having a look at the routine that I use to generate the SQL string to pass the database and frankly, it was bad.
I was just posting a question here to see if anyone els...
What's a simple way to combine feed and feed2? I want the items from feed2 to be added to feed. Also I want to avoid duplicates as feed might already have items when a question is tagged with both WPF and Silverlight.
Uri feedUri = new Uri("http://stackoverflow.com/feeds/tag/silverlight");
XmlReader reader = XmlReader.Create(feedUri.Abs...
Currently I am using NetTiers to generate my data access layer and service layer. I have been using NetTiers for over 2 years and have found it to be very useful. At some point I need to look at LINQ so my questions are...
Has anyone else gone from NetTiers to LINQ To SQL?
Was this switch over a good or bad thing?
Is there anything tha...
If I have a table in my database called 'Users', there will be a class generated by LINQtoSQL called 'User' with an already declared empty constructor.
What is the best practice if I want to override this constructor and add my own logic to it?
...
This answer says that Linq is targeted at a slightly different group of developers than NHibernate, Castle, etc.
Being rather new to C#, nevermind all the DB stuff surrounding it:
Are there other major, for lack of a better term, SQL wrappers than NHibernate, Castle, Linq?
What are the differences between them?
What kind of developers...
I normally run VS 2008 at home and LINQ is built in. At work we are still using VS 2005 and I have the opportunity to start a new project that I would like to use LINQ to SQL.
After doing some searching all I could come up with was the MAY 2006 CTP of LINQ would have to be installed for LINQ to work in VS 2005.
Does someone know the p...
I am having a really hard time attempting to debug LINQ to SQL and submitting changes.
I have been using http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx, which works great for debugging simple queries.
I'm working in the DataContext Class for my project with the following snippet from my application:...
Does anybody know how to apply a "where in values" type condition using LINQ-to-Entities? I've tried the following but it doesn't work:
var values = new[] { "String1", "String2" }; // some string values
var foo = model.entitySet.Where(e => values.Contains(e.Name));
I believe this works in LINQ-to-SQL though? Any thoughts?
...
Speaking as a non-C# savvy programmer, I'm curious as to the evaluation semantics of LINQ queries like the following:
var people = from p in Person
where p.age < 18
select p
var otherPeople = from p in people
where p.firstName equals "Daniel"
select p
Assuming that Person ...
When writing manual SQL its pretty easy to estimate the size and shape of data returned by a query. I'm increasingly finding it hard to do this with LINQ to SQL queries. Sometimes I find WAY more data than I was expecting - which can really slow down a remote client that is accessing a database directly.
I'd like to be able to run a que...