<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_ALinq －－最为完美的 Linq to DB 解决方案_分类_[20] ALinq &amp; Linq to SQL 技巧</title><id>http://feed.cnblogs.com/blog/u/28328/category/340154/rss</id><updated>2012-05-29T17:17:27Z</updated><generator>feed.cnblogs.com</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/category/340154.html"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/28328/category/340154/rss"/><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/12/04/2275241.html</id><title type="text">在 ALinq  中使用事务</title><summary type="text">下面是 ALinq 使用事务的例子，比较简单，直接上代码：var db = new AccessNorthwind("C:/Northwind.mdb") { Log = Console.Out };db.DoTransaction(delegate(){ db.Customers.Update(o =&gt; new Customer { CompanyName = "XXXX" }, o =&gt; o.CustomerID == "kkkkk"); db.Customers.Delete(o =&gt; o.CustomerID</summary><published>2011-12-04T02:05:00Z</published><updated>2011-12-04T02:05:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/12/04/2275241.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/12/04/2275241.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2009/04/28/1445474.html</id><title type="text">Linq to SQL 通过主键删除数据</title><summary type="text">很多朋友以在，在 Linq to SQL 里要删除数据，必须先读取，再进行删除，其实不一定。下面我给大家介绍通过主键进行删除的方法。代码比较简单，就不再解释了，如下：varuser=newUser{ID=10};db.Users.Attach(user);db.Users.Delete(user);db.SubmitChnages();如果你使用的是 ALinq ，更新，删除数据更为容易， 请点击这里。</summary><published>2009-04-28T07:38:00Z</published><updated>2009-04-28T07:38:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2009/04/28/1445474.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2009/04/28/1445474.html"/><content type="text">很多朋友以在，在 Linq to SQL 里要删除数据，必须先读取，再进行删除，其实不一定。下面我给大家介绍通过主键进行删除的方法。代码比较简单，就不再解释了，如下：varuser=newUser{ID=10};db.Users.Attach(user);db.Users.Delete(user);db.SubmitChnages();如果你使用的是 ALinq ，更新，删除数据更为容易， 请点击这里。</content></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2009/02/07/1385840.html</id><title type="text">Linq To SQL 下实现动态表名的映射</title><summary type="text">这段时间代码写累了，写几篇文章舒缓一下，也算是劳逸结合吧。如果觉得我的文章对你有用，请给点掌声，谢谢。提出问题前段时间，在博客园里看到有位朋友，问如何实现在动态表名。我们都知道，把一个实体类映谢到表里，应该这样写：CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--&gt;[Table(Name="User")]classUser{[Column]publicintID;[Column]publicstringName;}很明</summary><published>2009-02-07T03:53:00Z</published><updated>2009-02-07T03:53:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2009/02/07/1385840.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2009/02/07/1385840.html"/><content type="text">这段时间代码写累了，写几篇文章舒缓一下，也算是劳逸结合吧。如果觉得我的文章对你有用，请给点掌声，谢谢。提出问题前段时间，在博客园里看到有位朋友，问如何实现在动态表名。我们都知道，把一个实体类映谢到表里，应该这样写：CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--&gt;[Table(Name="User")]classUser{[Column]publicintID;[Column]publicstringName;}很明</content></entry></feed>
