Linq抛出System.StackOverflowException

edisonlzk 2008-06-23 10:48:41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
using System.Data.Linq.Mapping;

namespace LinqConsoleApp
{
[Table(Name = "Customers")]
public class Customer
{
private string _CustomerID;
[Column(IsPrimaryKey=true,Storage="_CustomerID")]
public string CustomerID
{
get { return this.CustomerID;}
set { this._CustomerID = value; }
}

private string _City;
[Column(Storage = "_City")]
public string City
{
get { return this._City; }
set { this._City = value; }
}
}

class Program
{
static void Main(string[] args)
{
DataContext db = new DataContext("Data Source=.;Initial Catalog=Northwind;Integrated Security=True");
Table<Customer> Customers = db.GetTable<Customer>();
db.Log = Console.Out;

IQueryable<Customer> custQuery =
from cust in Customers
where cust.City == "London"
select cust;

foreach (Customer cust in custQuery)
{
Console.WriteLine("ID={0}, City={1}", cust.CustomerID,cust.City);
}

Console.ReadLine();
}
}
}
...全文
25 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Xuon 2009-07-03
  • 打赏
  • 举报
回复
没具体看你的程序。
但我知道,这个异常往往是因为有死循环。

8,497

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 LINQ
社区管理员
  • LINQ
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧