I've seen many questions about this, but i've never really got the answer that I need.
I'm converting a fairly large web application from Web Forms to MVC and after a while I encountred a problem with passing data to the view. In the Action I execute the code:
//This is just an example
ViewData["QProducts"] = from p in db.Products s...
Is it possible to use LINQ in win32 DELPHI applications
...
I am trying to write a static function to Or two expressions, but recieve the following error:
The parameter 'item' is not in scope.
Description: An unhandled exception
occurred during the execution of the
current web request. Please review the
stack trace for more information about
the error and where it originated in
...
From my experience the major ORM frameworks for .NET (NHibernate, LinqToSql, Entity Framework) work best when they keep track of loaded objects. This works fine for simple client-server applications, but when using three- or more tier architecture with Web Services in a Service Oriented Archtitecture, this is not possible. Eventually, by...
Hi, I am planning a high performance e-commerce project in asp.net and need help in selecting the optimal data retrieval model for the product catalog.
Some details, - products in 10-20 categories- 1000-5000 products in every category - products listed with name, price, brand and image, 15-40 on every page - products needs to be listed ...
In SQL you can run a ISNULL(null,'') how would you do this in a linq query?
I have a join in this query:
var hht = from x in db.HandheldAssets
join a in db.HandheldDevInfos on x.AssetID equals a.DevName into DevInfo
from aa in DevInfo.DefaultIfEmpty()
select new
{
AssetID = x.AssetID,
Sta...
Here’s an interesting question. Suppose we have related tables in the database, for example, Instrument and Currency. Instrument table has a currency_id field that is mapped to entry in Currency table. In Linq land what’s the better way:
a) Create Instrument and Currency entities in the DataContext and then create association or simply ...
Hi,
Given the following code:
var people = new List<person>(){ new person { Name = "John", FamilyName = "Pendray" },
new person { FamilyName = "Emery", Name = "Jake"},
new person { FamilyName = "Pendray", Name = "Richard" } };
var q = from p in people
orderby p.Name
group p by...
I usually do not use Sql Server Management Studio, I usually use Linqpad to run all my db queries. Anyhow.... My boss seems to think that stored procs are "a lot faster than linq".
So to test this, I want to run a simple stored proc and display the time it takes to run against an equal linq statement.
Any good ideas on how to achie...
I am trying to start a new MVC project with tests and I thought the best way to go would have 2 databases. 1 for testing against and 1 for when I run the app and use it (also test really as it's not production yet).
For the test database I was thinking of putting create table scripts and fill data scripts within the test setup method an...
I have the following query in linq to entities. The problem is that i doesn't seems to load the "Tags" relation even thou i have a include thingy for it. It works fine if i do not join on tags but i need to do that.
var items = from i in db.Items.Include("Tags")
from t in i.Tags
...
I've got a list of People that are return from an external app and I'm creating an exculsion lists in my local app to give me the option of manually removing people from the list.
I have a composite key which I have created that is common to both and I want to find an efficient way of removing people from my List using my List
e.g
...
I have a stored procedure that uses output parameters like this:
ALTER PROCEDURE [GetAmount]
(
@orderID [int],
@totalcost decimal(18,2) OUTPUT
)
SELECT @totalcost = cost
FROM mytable
WHERE orderID = @orderID
When I drag the stored procedure onto the designer, the resulting code in the designer.cs file ends up losing the precisi...
My understanding of Linq to Sql is it will take my Linq statement and convert it into an equivalent SQL statement.
So
var products = from p in db.Products
where p.Category.CategoryName == "Beverages"
select p
Just turns into
Select * from Products where CategoryName = 'Beverages'
If that's the case, ...
I would like to convert the below "foreach" statement to a LINQ query that returns a substring of the file name into a list:
IList<string> fileNameSubstringValues = new List<string>();
//Find all assemblies with mapping files.
ICollection<FileInfo> files = codeToGetFileListGoesHere;
//Parse the file n...
Here's an example of the query I'm trying to convert to LINQ:
SELECT *
FROM Users
WHERE Users.lastname LIKE '%fra%'
AND Users.Id IN (
SELECT UserId
FROM CompanyRolesToUsers
WHERE CompanyRoleId in (2,3,4) )
There is a FK relationship between CompanyRolesToUsers and Users, but it's a many to many relatio...
Hi all,
I believe this is another easy one for you LINQ masters out there.
Is there any way I can separe a List into several separate lists of SomeObject, using the item index as the delimiter of each split?
Let me exemplify:
I have a List<SomeObject> and I need a List<List<SomeObject>> or List<SomeObject>[], so that each of these resu...
I have 62 columns in a table under SQL 2005 and LINQ to SQL doesn't handle the updates though the reading would work just fine, I tried re-adding the table to the model, created a new data model but nothing worked, I'm guessing I've hit the maximum number of columns limit on an object, can anyone explain that ?
...
I have a table that has a list of restaurant names and links to another table that holds the cuisine type.
I want to provide a search box on my web page that when typing, each word is searched for in the database and results returned. I was looking for a solution that doesn't involve setting up sql full text search as I want to be able ...
I'm trying to use Fluent-NHibernate's Query method which looks like this:
public T[] Query<T>(Expression<System.Func<T, bool>> where)
{
return _session.Linq<T>().Where(where).ToArray();
}
I'm using VB, so to send it a lambda expression I can call it with a line like this:
Dim products = flRepos.Query(Of Pr...