I have to be missing something obvious here. I don't get why this cast of the results of a linq query returns null and not the typed list I'm requesting.
IList<IMyDataInterface> list = query.ToList() as IList<IMyDataInterface>;
The complete code to run this is below. This is a knowledge gap I need to bridge. I have tried all kinds of ...
I am using ADO.Net Data Services and have a Service Operation that ends up returning the results of some linq to entities statements. As a part of those Linq statements there is a .Include("NavProp") to include a sub-object. When running this service operation it doesn't appear to return that expanded Include. Does anyone know either ...
I am writing an application where we will need to extend a basic entity into a number of different things (eg employee, vehicle etc). The design is as such that there is a Entity table and a second table with type specific values eg an employee will have an ID Number but a vehicle will have a registration number.
I have inherited from ...
I don't know LINQ, but from reading a lot around this site and others, it's a MUST HAVE skill for C# developers.
The problem is I am so booked on projects at work I have no time to pick up LINQ, I need to convince my boss to let me (and fellow coders) set aside some time so that we can become a LINQ house.
So.. my question is, what ar...
I have used LINQ to SQL with a update stored procedure to update databases in the past. I wanted to know if there is anything similar in LINQ to Dataset
An example of the LINQ to SQL Update:
Dim lqUpdate = lqUpdate.sprocUpdate(ColumnName, NewValue, ID)
...
For desktop programmers, do you avoid deploying .NET 3.5 framework on client machines for its big footprint? If so, is LINQBridge feature-complete?
[EDIT]
.NET 3.5 Framework evokes a feeling of OLE 2.0 (aka COM). When 2.0 newly came out, some users then are asking if there will be OLE version 3.0. But there will be none. OLE 2.0 is...
I have a combo box in Silverlight. It has a collection of values built out of the properties of one of my LINQ-to-SQL objects (ie Name, Address, Age, etc...). I would like to filter my results based off the value selected in a combo box.
Example: Say I want everyone with a last name "Smith". I'd select 'Last Name' from the drop down ...
What are the best resources to learn LAMBDA expressions? They still have me a bit confused and I don't use them much. Also LINQ has me a bit confused, since both things are more or less in the same boat, maybe you guys can offer some good LINQ resources too.
...
hello
I have a very big problem solving this issue
I have 2 tables
first table is :
which contains a modules (id and name)
second table is
which contains users ids and their preferred modules' numbers
now lets move to the problem
I want to generate a list of checkboxes
for example for the userid 1 which has the following module...
I am planning to write a LINQ provider, so that I can query data in a custom store - for example, let us say, some custom file format.
What is a good way to start? Any examples?
...
List<PageInfo> subPages = new List<PageInfo>();
// ...
// some code to populate subPages here...
// ...
List<Guid> subPageGuids = new List<Guid> {from x in subPages select x.Id}; //doesn't work
PageInfo has an Id field which is of type Guid. So x.Id is a System.Guid.
2nd line of code above does not work...I get two errors:
The best ...
Hi
I want to build dynamic linq.
But I want to dynamically set the table (from clause)
Is this possible?
Malcolm
...
I have two tables (well, two relevant for this question) :
Bets (holds the bets; Columns : Id, , MessagesPosted, )
Bets_Messages (holds the bets' forum messages; Columns : Id, BetId, )
When I insert a new BetMessage in Bets_Messages I want to update (increment to be precise) the corresponding field in Bets.
In pure T-SQL that would be...
I have a table that contains some blob fields that I don't want to load by default.
In a dbml file it is possible to set the delay loaded property for such fields.
Is there a similar option for external mapping files?
...
I've got a guy who is a wizard at writing stored procs and he can munch 10 tables down to a single column in no time at all. I'm half tempted to invest a couple of days to work with him on returning XML instead of rowsets because I can digest those all day long without any problem. I say that because it is a challenge to get a result of ...
I have this code:
using DC = MV6DataContext;
using MV6; // Business Logic Layer
// ...
public DC.MV6DataContext dc = new DC.MV6DataContext(ConnectionString);
IP ip = new IP(Request.UserHostAddress);
dc.IPs.InsertOnSubmit(ip);
dc.SubmitChanges();
// in Business Logic layer:
public class IP : DC.IP {
public IP(string address) { ... }
...
Hi,
I have some code like this:
Function GetTypeFromTableName(ByVal _TableName As String, ByVal _DataContext As DataContext)
Dim Mytype As Type = (From t In _DataContext.Mapping.GetTables Where t.TableName = "dbo." + _TableName Select t.RowType.Type).SingleOrDefault
Return Mytype
End Function
Dim DBA As ...
Hi,
I'm having a hard time understanding how I can form a LINQ query to do the following:
I have a table CallLogs and I want to get back a single result which represents the call that has the longest duration.
The row looks like this:
[ID] [RemoteParty] [Duration]
There can be multiple rows for the same RemoteParty, each which repre...
Whichever way I do it, it seems something goes wrong when using the conditional operator on enum values in Linq to Sql. For example
var ret = from listings in db.Listings
select new Listing
{
ID = listings.ID,
//etc
OrderStatus = listings.OrderItems.Count > 0
? listings.OrderItems.First().Order.OrderStatus : OrderStatu...
How do I add a second item to order by with this?
I want to order by a goalsScored element too.
var theteams =
(from teams in xdoc.Descendants("team")
orderby (int)teams.Element("points") descending
select
new Team(teams.Element("teamID").Value,
(int)teams.Elem...