随笔分类 - Linq
摘要:最近因为要开发大数据量网站,特作比较。Linq to SQL 查询 记录数:399997Linq to SQL 查询 Milliseconds:1910视图查询 记录数:399997视图查询 Milliseconds:3435Entity Framework 查询 记录数:400000Entity Framework 查询 Milliseconds:4049企业库存储过程 to DataReader 记录数:399997企业库存储过程 to DataReader Milliseconds:321企业库存储过程 to DataSet 记录数:399997企业库存储过程 to DataSet Mi
阅读全文
摘要:提高 LINQ to XML 中的性能的一种方法是预原子化 XName 对象。预原子化是指在通过使用 XElement 和 XAttribute 类的构造函数创建 XML 树之前,先将字符串分配给 XName 对象。然后传递初始化的 XName 对象,而不是将字符串传递给构造函数(此过程将使用从字符串到 XName 的隐式转换)。 XName Root = "Root"; XName Data =...
阅读全文
摘要:string xslMarkup = @" "; XDocument xmlTree = new XDocument( ...
阅读全文
摘要:XElement root = XElement.Load("Irregular.xml"); IEnumerable configParameters = root.Elements("Customer").Elements("Config"). Elements("ConfigParameter"); foreach (XElement cp in configParamet...
阅读全文
摘要://检索元素集合 XElement po = XElement.Load("c:/test.xml"); IEnumerable childElements = //from el in po.Descendants("Book") from el in po.Descendants("...
阅读全文
摘要:IEnumerable grandChildData = from el in StreamRootChildDoc(new StringReader(markup)) where (int)el.Attribute("Key") > 1 select (string)el.Element("Grand...
阅读全文
摘要:XDocument d = new XDocument( new XComment("This is a comment."), new XProcessingInstruction("xml-stylesheet", "href='mystyle.css' title='Compact' type='text/css'"), new...
阅读全文
摘要:XElement c = new XElement("Customers", new XElement("Customer", new XElement("Name", "John Doe"), new XElement("PhoneNumbers", new XElement("Phone", ...
阅读全文
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Linq; namespace linq { class Program { static void Main(string[] args) { ...
阅读全文
摘要:public IQueryable Find(TEntity obj) where TEntity : class { //获得所有property的信息 PropertyInfo[] properties = obj.GetType().GetProperties(BindingFlags.Public | BindingFlag...
阅读全文
摘要:Imports Imports Imports Imports Module Module1 Sub Main() Dim db As New NorthwindDataContext Dim customers = From customer In db.Customers _ Order By c...
阅读全文
摘要://C#的例子 using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.U...
阅读全文
摘要:Untitled Page Pick a cateogyr: ...
阅读全文
摘要:private void BindProducts(int startRow) { NorthwindDataContext db = new NorthwindDataContext(); //var ca = from c in db.Categories // where ...
阅读全文
摘要:配置文件 代码: using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using Sy...
阅读全文
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Linq; using System.Xml; namespace ConsoleApplication1 { class Program { static vo...
阅读全文