I need to replace the contents of a node in an XElement hierarchy when the element name and all the attribute names and values match an input element. (If there is no match, the new element can be added.)
For example, if my data looks like this:
<root>
<thing1 a1="a" a2="b">one</thing1>
<thing2 a1="a" a2="a">two</thing2>
<thing2 ...
I need something in between a full text search and an index search:
I want to search for text in one column of my table (probably there will be an index on the column, too, if that matters).
Problem is, I want to search for words in the column, but I don't want to match parts.
For example, my column might contain business names:
Mi...
Hey all,
I am looking for a way in LINQ to match the follow SQL Query.
Select max(uid) as uid, Serial_Number from Table Group BY Serial_Number
Really looking for some help on this one. The above query gets the max uid of each Serial Number because of the Group By Syntax.
...
I've got a situation where I need to use LINQ's ExecuteCommand method to run an insert.
Something like (simplified for purposes of this question):
object[] oParams = { Guid.NewGuid(), rec.WebMethodID };
TransLogDataContext.ExecuteCommand (
"INSERT INTO dbo.Transaction_Log (ID, WebMethodID) VALUES ({0}, {1})",
oParams);
The question ...
I have a working LINQ to SQL model. I want to be able to use the same model but with a connection to a DataSet object, instead of SQL Server.
I need to be able to query the model, modify fields, as well as do insert and delete operations. Is there an easy way to accomplish this?
I noticed another question mentions a similar scenario,...
Is it possible to do a cast within a LINQ query (for the compiler's sake)?
The following code isn't terrible, but it would be nice to make it into one query:
Content content = dataStore.RootControl as Controls.Content;
List<TabSection> tabList = (from t in content.ChildControls
selec...
I am looking for any examples or guides to using Linq over WCF (n-tier application). Please specify if you are showing something for Linq-to-SQL or Linq-to-entities. I would like to see usage examples for both.
I am wondering how things like deffered execution works over WCF (if it works at all)? Cyclic references support and so on... ...
I am creating a small application that will be deployed on Window. The database will have less than 10 tables.
Instead of installing a database on the client box is using XML documents for the database and LINQ going to cost in performance of queries, waiting for the XML file to be loaded and be written?
If I use a database I will ...
Can this be done w/ linqtosql?
SELECT City, SUM(DATEDIFF(minute,StartDate,Completed)) AS Downtime
FROM Incidents
GROUP BY City
...
I'm trying to combine a list of functions like so.
I have this:
Func<int, bool>[] criteria = new Func<int, bool>[3];
criteria[0] = i => i % 2 == 0;
criteria[1] = i => i % 3 == 0;
criteria[2] = i => i % 5 == 0;
And I want this:
Func<int, bool>[] predicates = new Func<int, bool>[3];
predicates[0] = i => i % 2 == 0;
predicates[1] = i =...
Hi,
I'm encountering some peculiarities with LINQ to SQL.
With a relatively simple query, I want to select some fields, but have the date fields formatted as strings, which I first achieved like this:
var list = dataContext.MyLists.Single(x => x.ID == myId);
var items = from i in list.MyItems
selec...
Any XPath like /NodeName/position() would give you the position of the Node w.r.t it's parent node.
There is no method on the XElement (Linq to XML) object that can get the position of the Element. Is there?
...
I'm considering one of two IRepository interfaces, one that is a descendant of IQueryable and one that contains IQueryable.
Like this:
public interface IRepository<T> : IQueryable<T>
{
T Save(T entity);
void Delete(T entity);
}
Or this:
public interface IRepository<T>
{
T Save(T entity);
void Delete(T entity);
I...
I am new to LINQ, but I am wondering if it is possible to use LINQ to pivot data from the following layout:
CustID | OrderDate | Qty
1 | 1/1/2008 | 100
2 | 1/2/2008 | 200
1 | 2/2/2008 | 350
2 | 2/28/2008 | 221
1 | 3/12/2008 | 250
2 | 3/15/2008 | 2150
into something like this:
CustID | Jan- 2008 | Feb...
When I retrieve a record using LINQ that has a DateTime field only the ToString() is available.
Where are all the other DateTime methods?
I have to Convert.ToDateTime the DateTime? that the Field returns?
What is the difference between (DateTime) and (DateTime?)
...
Okay, so I'm doing my first foray into using the ADO.NET Entity Framework.
My test case right now includes a SQL Server 2008 database with 2 tables, Member and Profile, with a 1:1 relationship.
I then used the Entity Data Model wizard to auto-generate the EDM from the database. It generated a model with the correct association. Now I ...
I have a method that takes an IQueryable. Is there a LINQ query that will give me back the size of each column in the IQuerable?
To be more clear: this is Linq-to-objects. I want to get the length of the ToString() of each "column".
...
I need to retrieve a set of Widgets from my data access layer, grouped by widget.Manufacturer, to display in a set of nested ASP.NET ListViews.
The problem is that (as far as I can tell) the nested ListView approach requires me to shape the data before using it, and I can't figure out the best approach to take. The best I've been able t...
What's the best open source LINQ provider (in terms of completeness)?
I'm developing an open source LINQ provider myself and I'd like to borrow as many ideas as I can, avoid common pitfalls, etc.
Do not restrict yourself to database LINQ providers, any provider suggestion is welcome.
...
just wanted to gather different ideas and perspectives as to which layer should (and why) LINQ fall into?
...