<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_ALinq －－最为完美的 Linq to DB 解决方案_分类_[10] ALinq 教程</title><id>http://feed.cnblogs.com/blog/u/28328/category/322450/rss</id><updated>2012-05-29T13:29:31Z</updated><generator>feed.cnblogs.com</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/category/322450.html"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/28328/category/322450/rss"/><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/10/20/2218525.html</id><title type="text">ALinq3 新功能简介 （五）[未完，待续]</title><summary type="text">四、动态查询（一）7、数据处理1）更新操作使用 Linqtable.Update(o =&gt; new Employee { FirstName = "AAA", LastName = "BBB" }, o =&gt; o.EmployeeID == -1);动态更新table.Update("FirstName = 'AAA', LastName = 'BBB'", "EmployeeID == -1");使用参数table.Update("FirstName = @0</summary><published>2011-10-20T02:45:00Z</published><updated>2011-10-20T02:45:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/10/20/2218525.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/10/20/2218525.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/10/18/2214199.html</id><title type="text">ALinq3 新功能简介 （四）[未完，待续]</title><summary type="text">四、动态查询（一）ALinq2 是没有自己的动态查询的，很多用户都是采用 Linq to SQL 的动态查询库（Linq to SQL Dynamic），但是，这里个库并不完善，并且也不再跟新维护了。而且，这个库并非专门为 ALinq 设计的，并不支持一些 ALinq 专有的功能。不少用户在使用这个库的时候，碰到不少问题，来找我们寻求帮助。因此，我们决定亲自实现，并且为 ALinq 度身定做，现在已经集成在 ALinq3 里面了。1、匿名类对象的创建1）使用 new 关键字创建匿名类对象。示例一：Linq 查询var table = db.GetTable&lt;Employee&gt;();</summary><published>2011-10-18T03:28:00Z</published><updated>2011-10-18T03:28:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/10/18/2214199.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/10/18/2214199.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/10/13/2209954.html</id><title type="text">ALinq3 新功能简介 （三）[未完，待续]</title><summary type="text">三、基于接口的数据操作这个功能，主要是解决 ALinq 单表继承的一些不足之处。先来看一个实例。有一 CMS 系统，无论文章，还是类别，都要实现可能让用户自行调整次序的功能。那么我们可以设定这么一个接口：interface OrdinalEntity{int ID{get;}int ordinal{get;set;}}然后，类别和文章分别从该接口继承，下面的都是伪代码，为了说明问题。public class Category：OrdinalEntity{ public int ID; public int Ordinal; public string Name;}public...</summary><published>2011-10-13T03:11:00Z</published><updated>2011-10-13T03:11:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/10/13/2209954.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/10/13/2209954.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/10/12/2207324.html</id><title type="text">ALinq3 新功能简介 （二）[未完，待续]</title><summary type="text">在上一篇文章介绍了索引器影射的概念，我们现在再来深入了解一下索引器影射，文章的结尾，会答复一些朋友提到的问题。二、深入理解索引器影射我们先来定义一个实体类，注意到，我们在这里定义了一个 ID 属性，并且把它影射到了 EmployeeID 列。[Table(Name = "Employees")]class MyEmployee{ private Dictionary&lt;string, object&gt; values; public MyEmployee() { this.values = new Dictionary&lt;string, object&gt;();</summary><published>2011-10-12T09:49:00Z</published><updated>2011-10-12T09:49:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/10/12/2207324.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/10/12/2207324.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/10/10/2205710.html</id><title type="text">ALinq3 新功能简介 （一）[未完，待续]</title><summary type="text">在正文开始之前，先聊些题外话，和一些同行聊天的时候，告诉他们，我是专门做 ORM 的，而且还能卖钱，都表示很惊讶，在 ORM 泛滥的今天，N 多 ORM 都是求着别人用的，ALinq 竟然能收费。我跟他们说，“如果你想知道为什么，亲自下载来用一下。”我的用户虽然不多，但是，绝对都是铁杆用户，前段时间一位巴西的用户，换了新工作，到了新公司后，立马向他们公司推荐购买 ALinq 。我们做产品，一直坚持的原则就是为客户解决他们在实际开发中碰到的问题。由于我们的产品切切实实解决了用户所碰到难题，所以很受用户的喜欢。如果说 ALinq 2.0 主要专注于解决 Linq to SQL 在无法应用于多数库的</summary><published>2011-10-10T10:41:00Z</published><updated>2011-10-10T10:41:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/10/10/2205710.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/10/10/2205710.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/09/28/2194504.html</id><title type="text">ALinq &amp;amp; ORDesigner FAQ &amp;amp; ALinq3 （Beta）下载</title><summary type="text">产品下载ALinq3 免费版for NET4 下载 (免费版，对于一个数据库仅允许 18 个表，无时间或其它限制）注：仅供预览测试使用，API 在正式版可能还会有所变动。１、使用 ORDesigner 无法生成代码选择当前的 *.admf 文件，在属性窗口中，请确认 Custom Tool 的属性为 ALinqCodeGenerator 。如果该项为空白，请手动输入 ALinqCodeGenerator 。请留言 Error List 窗口提示的错误，然后再报告该错误。如下图所示：２、如何保持表名，字段名称不变？答：选择菜单 Tools -&gt; Options -&gt;ORDesigne</summary><published>2011-09-28T07:49:00Z</published><updated>2011-09-28T07:49:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/09/28/2194504.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/09/28/2194504.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/05/10/2041380.html</id><title type="text">使用 ALinq 实现 Linq to MySQL</title><summary type="text">但 VS 自带的 Linq to SQL 是不支持mysql，但没关系，我们给大家提供了一个卓越的解决方法。就是 ALinq 了。有关 ALinq 的介绍以及使用，请点击这里。１、软件安装 安装 ALinq 和 ORDesigner点击这里下载ALinq点击这里下载 ORDesigner_VS2008 点击这里下载ORDesigner_VS2010另外还需要安装 ADO.NET MySQL Provider点击这里下载 MySQL ADO.NET Data Provider（当然，如果你已经安装了，则不需要再安装了）２、添加 ADMF 文件到到项目添加链接到 Server Explorer 面</summary><published>2011-05-10T03:45:00Z</published><updated>2011-05-10T03:45:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/05/10/2041380.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/05/10/2041380.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/05/06/2038672.html</id><title type="text">了解 ALinq 数据类型的映谢</title><summary type="text">在深入了解 ALinq 是如何处理数据类型映射之前，我们先来看一个例子：以 Northwind 数据库中的 Territories 表为例，表如下图所示。实体类：[Table(Name = "Territories")]public partial class Territory{[Column]public string Id{get;set;}[Column]public string TerritoryDescription{get;set;}[Column]public int RegionID{get;set;}}在这个实体类中，所有字段的 Column Attr</summary><published>2011-05-06T03:13:00Z</published><updated>2011-05-06T03:13:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/05/06/2038672.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/05/06/2038672.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037432.html</id><title type="text">ALinq 使用教程（九）绑定数据到 GridView （LinqDataSource 使用）</title><summary type="text">创建一个 Web Application 项目。将 ALinqDataSource 添加到工具栏。右键点击工具栏中的 General 项，在弹出的菜单中，选择 Choose Items 项，然后在对话框中，选择 ALinqDataSource 项，点击 OK 按键关闭对话框。添加 ALinqDataSource 和 GridView 控件，并进行绑定。另外再拖一个 TextBox 用来输出生成的 SQL 语句。如下图所示：点击这里下载源码</summary><published>2011-05-05T03:28:00Z</published><updated>2011-05-05T03:28:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037432.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037432.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037429.html</id><title type="text">ALinq 使用教程（七）ALinq 的扩展</title><summary type="text">ALinq 在 Linq to SQL 的基本，做了一些扩展，使得它更为好用。获取实体类的 DataContext对象选择Category 实体类，将 DataContext 设为 True 。运行下面的代码：Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--&gt;static void Main(string[] args){var dc = new NorthwindDataContext() { Log = Console.Out };var </summary><published>2011-05-05T03:26:00Z</published><updated>2011-05-05T03:26:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037429.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037429.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037416.html</id><title type="text">ALinq 使用教程（六） T4 模版生成代码</title><summary type="text">禁用原来的代码生成（可选步骤）选择 Northwind.admf 文件，在属性窗口中，将 Custom Tool 属性设置为空，原来值为 ALinqCodeGenerator 。选择模版右键点击项目，在弹出的菜单中，选择 Add ALinq Template，然后选择 Entities.tt 模版，在弹出窗口中，选择 Northwind.admf 模型，点击 OK 按钮后生成代码。</summary><published>2011-05-05T03:20:00Z</published><updated>2011-05-05T03:20:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037416.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037416.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037410.html</id><title type="text">ALinq 使用教程（五）使用 Xml 映射文件</title><summary type="text">创建 Xml 映射文件点击设计器，在 External Mapping 属性设为 True，然后按保存生成代码，在 Northwind.admf 项目下面，你会发现新生成了一个 Northwind.designer.map 文件。使用 Xml 映射文件在使用下面的代码时，请记得修改 filePath 变量。代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--&gt;static void Main(string[] args){var filePat</summary><published>2011-05-05T03:16:00Z</published><updated>2011-05-05T03:16:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037410.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037410.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037404.html</id><title type="text">ALinq 使用教程（四）验证实体类</title><summary type="text">添加 Validate Attribute 到属性选取 Product 类中的 PropertyName 属性，在属性窗口中，选择 Attributes 项，然后点击旁边的按钮。在弹出的对话框中，双击左边 Attribute List 中的 RequiredAttribute 项，将其添加到右边。在属性窗口中，将 AllowEmptyString 设为 False ，点击 OK 按钮保存。实现扩展方法在设计器中，鼠标右键点击 Product 类，在弹出的菜单中，选择 ViewCode （或者按 F7快捷键）。导入命名空间Code highlighting produced by Actipro</summary><published>2011-05-05T03:14:00Z</published><updated>2011-05-05T03:14:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037404.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037404.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037312.html</id><title type="text">ALinq 使用教程（一）软件的安装</title><summary type="text">安装 ALinq 和 ORDesigner点击这里下载ALinq点击这里下载 ORDesigner_VS2008 点击这里下载ORDesigner_VS2010如果你使用数据库是 SQLite， MySQL，或者 Firebird，你还需要安装第三方的 ADO.NET Data Provider 。如果你使用的是 Oracle 数据库，你还可以使用 Oracle 公司提供的 ADO.NET Data Provider (ODP.NET)（可选）点击这里下载 SQLite ADO.NET Data Provider点击这里下载 MySQL ADO.NET Data Provider点击这里下载 </summary><published>2011-05-05T03:11:00Z</published><updated>2011-05-05T03:11:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037312.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037312.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037392.html</id><title type="text">ALinq 使用教程（三）数据的增、删、改</title><summary type="text">创建 DataContext 对象Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--&gt;var dc = new NorthwindDataContext(){Log = Console.Out};插入数据Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--&gt;var product = new Prod</summary><published>2011-05-05T03:10:00Z</published><updated>2011-05-05T03:10:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037392.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037392.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037386.html</id><title type="text">ALinq 使用教程（二）创建实体类</title><summary type="text">添加数据库连接到在 Server Explorer 面板中，创建数据库连接。下面以 Access 数据库为例。将表拖放到设计器新建一 Console Application 项目 ，然后添加新项，在弹出的对话框架，选择 Data 项，然后选择 ORDesigner，在名称中键入 Northwind.admf，然后选取 Categories 表，将其拖入到设计器中。查询数据点击选择设计器，在 Property 窗口中，请确认 DataContext 对象名称为 NorthwindDataContext，如果不是，请改为 NorthwindDataContext 。打开 Program.cs 文件</summary><published>2011-05-05T03:10:00Z</published><updated>2011-05-05T03:10:00Z</updated><author><name>麦舒</name><uri>http://www.cnblogs.com/ansiboy/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037386.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ansiboy/archive/2011/05/05/2037386.html"/><content type="html"/></entry></feed>
