I'm playing around with the .NET Entity Framework, and my first task is to populate a grid, from which single objects are chosen for editing. My prior code simply calls a DB view, which uses joins to give me a denormalised, human readable display record. Now, building an OR mapped model, I come to a choice. Do I add my view, or should...
Hi all,
I've got a strange (correct me if I'm wrong) bug/feature with Linq to SQL that's puzzling me and trying to understand what's happening.
So I've taken the whole process procedurally in the hope of trying to find a resolution and have been unable to fix so far.
Here's a repro of what is happening:
Record change made to databas...
I am building a plugin for a LAN party website that I wrote that would allow the use of a Round Robin tournament.
All is going well, but I have some questions about the most efficient way to rank over two criteria.
Basically, I would like the following rakning layout:
Rank Wins TotalScore
PersonE 1 5 50
PersonD 2 ...
I have a database called MasterDatabase that has table MainIndex with columns Id, Database (nvarchar), Table(nvarchar)
and I have 2 other databases with tables and data.
Is there a way to substitute the FROM statement with results from the MasterDatabase.MainIndex?
Can this be done with LINQ?
...
I'm overloading a vb.net search procedure which queries a SQL database.
One of the older methods i'm using as a comparison uses a Stored Procedure to perform the search and return the query.
My new method uses linq.
I'm slightly concerned about the performance when using contains queries with linq. I'm looking at equally comparable que...
Is there any way to convert a collection of objects into a single new object using LINQ?
I want to use this within another LINQ to SQL expression.
...
I have read in some blog some time ago (sorry for being vague) that i could use a linq like the following
var list = from c in xml
select new
{
foreach(XElement el in c.Elements())
{
}
}
Does anyone know is it possible or is it just my imagination??
Thanks.
...
I have the following XML Document being loaded into C# Silverlight:
<parent>
<son name="Jim">
<grandson>Billy</grandson>
<granddaughter>Sue</granddaughter>
</son>
<daughter name="Sally">
</daughter>
</parent>
I'd like to do a LINQ query so that I query parent and get a list of "son" and "daughter" nod...
Hello,
I need some help with CASE statements in linq (c#):
osc_products.products_quantity =
CASE
WHEN itempromoflag <> 'N' THEN 100000
WHEN itemcat1 IN ('1','2','31') AND itemsalestatus = 'S' THEN 100000
WHEN itemsalestatus = 'O' THEN 0
ELSE cds_oeinvitem.itemqtyonhand - cds_oeinvitem.itemqtyc...
This is not about DBNull vs Null. I understand the difference.
What I would like to know is if I am using Linq, say to access a User.EmailAddress, then checking User.EmailAddress == null is the same as User.EmailAddress == DBNull correct?
My reasoning is that the absence of data in the database results into Linq not generating an objec...
I have the following query:
var MyQuery = from e in ContractContext.Equipments.Include("Manufacturers")
where e.Customers.ID == customer.ID
select e;
And everything works, I get my Equipments and it loads the Manufacturers table correctly (eagerly). But when I try to do the following many-to-many query:
v...
How could I extend my data context objects (generated by Linq To Sql) so I can attach another interface to them, add other properties etc.? I don't want this to get overwritten the next time I'm rebuilding the classes from the database.
...
Starting here:
public class Customer
{
public int CustomerID { get; set; }
public string CustomerName { get; set; }
public IList<Order> Orders { get; set; }
}
public class Order
{
public int OrderID { get; set; }
public int CustomerID { get; set; }
}
What would be the linq query that you write to retrieve all Orders from ...
I'm trying to add another restriction on a method within a generic class. Is this possible?
Pseudocode:
public class MyBaseClass<T> where T: class
{
public IQueryable<T> ShowThisMethod where T: class, IMyInterface
{
// stuff.
}
}
ShowThisMethod should only be available when T is IMyInterface. Also IMyInterface...
I'm trying to figure out the correct syntax to make it work. Here's an example. Could you correct it/translate it into linq syntax?
From p In products()
group p by p.Category into g
select new { Category = g.Key,
TotalUnitsInStock = if(g.key="b", g.Avg(p => p.UnitsInStock),
...
Hi,
Is there a LINQ way to accomplish this? Any help is greatly appreciated.
class Program
{
static void Main(string[] args)
{
Parent parent1 = new Parent();
parent1.Name = "P1";
Parent parent2 = new Parent();
parent2.Name = "P2";
Child child1 = new Child();
child1.Name = "C1"...
good morning!
i have the following object in a list:
public class DemoClass
{
public int GroupKey { get; set; }
public string DemoString { get; set; }
public object SomeOtherProperty { get; set; }
}
now i want to create following dictionary out of it:
Dictionary<int, List<DemoClass>>
following behaviour is tried to app...
i hava a table below
number
8789789
9080992
3213123
2143123
1312321
.......
.......
1232123
almost 50.000 rows
i want to get ordered numbers like
856620
856621
856622
856623
856624
856625
856626
856627
856628
856629
or
216350
216351
216352
216353
216354
216355
216356
216357
216358
216350
i want to get from table grouping 10 numbe...
I have been playing with some LINQ ORM (LINQ directly to SQL) and I have to admit I like its expressive powers . For small utility-like apps, It also works quite fast: dropping a SQL server on some surface and you're set to linq away.
For larger apps however, the DAL never was that big of an issue to me to setup, nor maintain, and more...
string[] ssss = "1,2,,3".Split(new[] {','}).Where(a=>!string.IsNullOrEmpty(a)).Select()
How does this works?
...