Hi folks,
i'm trying to figure out how I can use Linq to filter out some of my appsettings from my web.config file.
i'm trying to do something like the following (which has wrong syntax) :-
var query = from q in System.Web.Configuration.WebConfigurationManager.AppSettings.Keys
where q.StartsWith("Foo")
select q...
I'm adding more keywords to notepad++'s C# Syntax highlighting and it would really help if i had a complete list of LINQ keywords for c#.
...
Hi, there is any way to order a query by a many-to-many relation table column in linq? and in scottgu's DynamicLinq?
For example:
Products: p_id, p_name
Product_Order: p_id, o_id, quantity
Order: o_id, o_name
how can I query for order by Product_Order quantity?
from p in model.Products
order by p.Product_Order.quantity
select p
...
I'm using LINQ to SQL to query my database, I have a query very similar to this:
var result = from db.MyTable.Where(d => (double)d.Price >= minValue)
I need the where clause to have a d.Proce >= minValue, and d.Price =< maxValue (like a T-SQL BETWEEN clause).
How can I do this?
...
Hi,
Working on a Online Test.
I have 3 tables
Questions
Subject
Topic
I have made a Store Proc which return 25 Random Records. I want to store it in-memory and then display 1 question at a time with AJAX. I don't want to hit database 25 times as there are many users, I tried and store the result in viewstate but then I am not able ...
Hi All,
I need advice. I have application that imports 10,000 rows containing name & address from a text file into XElements that are subsequently added to a synchronized queue. When the import is complete the app spawns worker threads that process the XElements by deenqueuing them, making a database call, inserting the database output ...
Hello, you can use LINQ in an object that exposes only Add(),Remove(),Count(),Item() and GetEnumerator () from System.Collections.IEnumerator?
Thanks in advance.
Bye.
...
Hi I have the following cod throughout my app but with just two fields it's not working.
[Required]
public string DevelopmentPM { get; set; }
The following test runs and passes:
[TestMethod]
public void SiteConstruction_MODEL_DevelopmentPM_Is_Required()
{
//arrange
var propertyInfo = typeof(SiteCon...
I have a class called UserInfo that contains details about a given user.
There are several places in code where the data might be queried and I'd like to have a single function to fill the UserInfo object with the corresponding data from the Linq Query.
var userData = dc.Users.Where(λ => (λ.Login == username) && λ.Activ...
Which type exception checking required in linq inside try/catch block while performing CRUD(create,read,update,delete) OPERATIONS
for eg:
try {
db.SubmitChanges(ConflictMode.ContinueOnConflict);
}
catch (ChangeConflictException e) {
foreach (ObjectChangeConflict occ in db.ChangeConflicts) {
// All database values overwr...
I'm looking into LINQ and the query language appears (at least on the surface) to be nothing more than an implementation of map and/or list comprehensions as found in Haskell and other FP languages (particularly the generalisation of 'map' and 'for' in Scala). Is this correct? Is there more to the syntax than this? From the breathless to...
Hello,
I know that I can create LINQ Associations without a Foreign Key. The problem is, I've been doing this by adding the [Association] attribute in the DBML file (same as through the designer), which will get erased again after I refresh my database (and reload the entire table structure).
I know that there is the MyData.cs file (as ...
Hi guys.
I'm currently trying to run a LINQ query over a MS SQL database. This is what I have done.
I can see the database, the table, and the data inside if i want to via the Server Explorer.
I've created a new DataSet automatically from "Add new item..". I've then dragged the table from the server explorer into the designer view of...
I'm generating domain model using LINQ to SQL via the VS2008 built-in editor. That works really well, too; when I adjust my database schema I simply delete everything from the editor and then pull it back in from the server explorer by selecting all tables and dragging them into the designer surface. That works great too.
Now the proble...
Hello,
I have C# extension methods on IQueryable, e.g. FindNewCustomers() and FindCustomersRegisteredAfter(int year) and so forth which I use to "chain" a query together for LINQ to SQL.
Now to my problem: I want to create compiled queries, e.g.:
private static Func<MyDataContext, SearchInfo, IQueryable<Customer>>
CQFindAll ...
This is a bit of a poser, and I hope you'll find this challenging problem as interesting as I do... :)
I have a subclass of DataContext called MyDataContext, wherein I have overridden the SubmitChanges() method with some code of the form:
BeginTransaction(); // my own implementation
IList<object> Updates = GetChangeSet().Updates;
forea...
I have two tables
Video
VideoId,
VideoName,
VideoUrl
Comment
CommId,
VideoId,
CommentDesc,
Rating
I want to join and get average rating for video using LINQ
How can I do this?
...
I know I can't use something like int[] or list as a parameter to a compiled query, but I need to find someway get the performance benefits of a compiled query that accepts n number of integers as a parameter.
Has anyone found any work arounds or alternative solutions to this issue?
...
Any advice on when DataTable.Select should be used versus LINQ Select when dealing with an in-memory DataTable?
I find LINQ syntax easier and more powerful, but I'm not sure if there are performance or other issues which make a DataTable select preferable.
(I'm using a third party API that provides a DataTable that has been pre-populat...
Hello,
I want to 'build' a combined query for Subsonic 3.0.0.3, what is the best way for this?
I tried;
Expression<Func<Person, bool>> exp = p => true;
Expression<Func<Person, bool>> fContinent = p => p.ContinentID == 1;
Expression<Func<Person, bool>> fType = p => p.TypeID == 1;
exp = Expression.Lambda<...