Everything in my Linq query is working properly except for the area where I'm trying to populate a sub-collection with data. (Anything referencing ChannelInfo).
ChannelInfo does appear in Intellisense, so it is recognized as a property of the new OfferType. The right side of my setters for ChannelInfo are also recognized and accessibl...
I have two tables, Tasks and TaskMilestones. I want a query to return the most recent past milestone and the nearest future TaskMilestone for each Task. I'm working with C#/LINQ-to-SQL. How do I go about this?
Task columns: Id, TaskName
TaskMilestones columns: Id, TaskId, MilestoneName, MilestoneDate
I want a return table with rows...
Hi I have a query as -
var query=from e in DataContext.Employees
join d in DataContext.Dept
on e.DeptId equals d.Id
join o in DataContext.OtherInfo
on e.Id equals o.EmployeeId
where e.EmployeeId==4
select new Employee_Dept//DTO
{
EmployeeName=e.Name,...
Could somebody assist me in converting a sql query into LINQ, i'm pretty handy with linq but this is a bit much and i can't download linqpad here!
select
t.*,
l.*
from
email_templates t
left join
(select
id as email_id,
sent_at,
sent_by
from
email_log
where
id = (sel...
I was under the impression that the only difference between Func and Action is that the former has to have a return value.So I thought you can call a recursive linq from either a Func or Action. I am new to C# and I am just experimenting and curious.
So I tried the following to recursively print the nested types within a Type.
Type t ...
I seem to be a bit stuck on this, but my experience in Linq is not great. Basically, I have something like this code:
public class Point
{
public int X { get; set; }
public int Y { get; set; }
}
public class B
{
public List<Point> Points { get; set; }
public B(IEnumerable<int> Xs, IEnumerable<int> Ys)
{
// H...
Is there a way to take out the foreach in the following code in linq yet produce the same output?
DropDownList ddl = new DropDownList();
foreach (DataRow row in ds.Tables[0].Rows)
{
if ((byte)row["ListTypeID"] == 0)
{
item = new ListItem(row["ListText"].ToString(), string.Format("{0}:{1}", row["Li...
Hi,
At the moment I have ResultsCollection = List<MyDataStructure>; which is then analysed with LINQ using something like:
var OrderedData = from tc in ResultsCollection
...
select new { myLink = g.Key, Count = g.Count(), First = g.First() };
At the moment I have a Repeater that is deifned using:
myRepeater.DataSource = ResultsCol...
I have a WCF Service which retreives data via Linq2SQL. I am getting all the child records, just not the related parent records
i.e Customer record has related Orders, and there is a status on the customer. I am getting the customer and the orders, but I cannot get the status record to get the status description
using (MyDataContext c...
I have an application in mind which dicates database tables be append-only; that is, I can only insert data into the database but never update or delete it. I would like to use LINQ to SQL to build this.
Since tables are append-only but I still need to be able to "delete" data, my thought is that each table Foo needs to have a correspo...
i have some code that looks like this and creates a list from an existing collection
var items = items.ConvertAll(r => new
{
description = FormatDescription(r),
start = r.Milestone.HasValue ? r.Milestone.Value.ToString("yyyy-MM-ddTHH:mm:ssZ") : DateTime.Today.ToString("yyyy-MM-ddTHH:mm:ssZ"),...
The only way that I know of to make an async call using Linq to SQL is to compose an IQueryable and then ask the data context for the equivalent SqlCommand using GetCommand, which provides the BeginExecuteReader method. This approach didn't work for stored procedures and required some hackery to essentially use reflection to generate the...
I would like to create a query with a cross apply into a user defined table value funtion in LINQ. The SQL would be really rather simple as below:
SELECT *
FROM MyTable mt
CROSS APPLY MyTVF(mt.id)
This post gives an example of a LINQ query that results in generated sql that contains both a cross apply and an outer apply but only for ...
I have such XMl
<root>
<list>
<list>
<topic></topic>
<topic></topic>
</list>
<topic></topic>
<topic></topic>
</list>
<topic></topic>
<topic></topic>
<topic></topic>
</root>
I need to get the first level of children:
<list></list>
<topic></topic>
<topic></topi...
I successfully ran the following statement with the NorthWind.sdf in LinqPad:
from s in Shippers
select new
{
s.ShipperID,
s.CompanyName,
Count=s.ShipViaOrders.Count()
}
At the same time , I failed to run a similar statement with the Odata Service (http://services.odata.org/northwind/northwind.svc) in Linq...
I am using ASP.NET MVC2 and I would like to make up a url based on the current one in the address bar inside a HtmlHelper extension. So far I have this:
url = helper.ViewContext.RequestContext.RouteData.Values
.Aggregate<KeyValuePair<String, Object>>((w, next) => w + next);
But that does not compile. Anyone has a good idea on h...
hello,
I am developing a application with asp.net 4.0. My site will be a heavy like more then hundreds of user will be online at a time and lots of content will be there. I have checked both ado.net entity framework 4.0 and Linq-To-SQL with Microsoft.NET Framework 4.0 both are having great improvement over there. I am confused that whic...
Hi All,
I am new to wpf and Linq. I want to learn data binding in wpf using linq. Which book i can prefer to learn Linq.
Geetha.
...
Hi,
I am using Entity Framework 4.0 and trying to use the "Contains" function of one the object sets in my context object. to do so i coded a Comparer class:
public class RatingInfoComparer : IEqualityComparer<RatingInfo>
{
public bool Equals(RatingInfo x, RatingInfo y)
{
var a = new {x.Pl...
Hi
I have an xml file with about 500 mb and i'm using LINQ with c# to query that file, but it's very slow, because it loads everything into memory. Is there anyway that i can query that file without loading all into memory?
Thanks
...