惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
Know Your Adversary
Know Your Adversary
P
Palo Alto Networks Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
L
LINUX DO - 热门话题
P
Proofpoint News Feed
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
Cisco Talos Blog
Cisco Talos Blog
AI
AI
L
LINUX DO - 最新话题
H
Heimdal Security Blog
Hacker News: Ask HN
Hacker News: Ask HN
Webroot Blog
Webroot Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The GitHub Blog
The GitHub Blog
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
有赞技术团队
有赞技术团队
S
Securelist
博客园_首页
IT之家
IT之家
Schneier on Security
Schneier on Security
博客园 - 叶小钗
罗磊的独立博客
WordPress大学
WordPress大学
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
W
WeLiveSecurity
The Register - Security
The Register - Security
D
DataBreaches.Net
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
Recorded Future
Recorded Future
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tailwind CSS Blog
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
T
Tor Project blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com

博客园 - 稽首本然

Nhibernate 教程,有空看看 Jquery专题写的不少,有空看看,另该研究下门面模式了! Java开源权限管理中间件 《需求规格说明书》业务描述活动图 《需求规格说明书》(用例)陷阱 《需求规格说明书》核心功能表现方式(用例) ScriptManager与UpdatePanel总结 Nunti测试工具使用整理 一个关于NHiberante,Linq数据源与UI交互引发的思考 数据库联接字符串 LINQ TO OBJECT ASPX直接编写脚本function后使用javascript Aspx页面中直接编写javascript脚本 母版事件中注册javascript脚本 ASPNET跨页面传值技巧总结 javascript捣乱程序 Javascript在Asp.Net中的应用汇总 AjaxPanel中使用javascript AjaxPanel控件说明
LINQ TO SQL
稽首本然 · 2011-02-11 · via 博客园 - 稽首本然

1.DLINQ总结

LinqtoSQL是微软Linq类的一部分,应该说Linq to SQL叫做DLinq

DLinq不等于Linq,Linq在.net项目开发过程中有特有的优势与缺点.

DLinq是对SqlServer的一种应用集,可以是框架级的.对SqlServer ORM的应用非常简单,不需要一行代码,一个XML文件的编写,而能实现1-1,1-N的映射,当然也能够提供CRUD功能,乃至存储过程,并发,锁,存储过程等等!

2.正确的使用DLINQ需要,熟悉.net3.0的几个新特性,它们都很简单,但非常有用.

2.1 隐士类型转换

2.2 匿名类型

2.3 扩展方法

2.4 自定义属性

2.5 对象初始化器

2.6 集合初始化器

2.7 Lambda表达式

2.8 查询方法

3.DataContext -System.Data.Linq的重要组成部分

翻译为数据上下文,用于将LINQ语言翻译成SQL,执行SQL和以日志形式进行操作

http://www.cnblogs.com/lovecherry/archive/2007/08/15/856977.html

3.1 DLINQ实体映射类-手动创建

如:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq.Mapping;

namespace LinqDemo04_DataContext例子
{
    [Table(Name="Customers") ]
    public class Customer
    {
        [Column(IsPrimaryKey = true )]
        public string CustomerID { get; set; }
        [Column(Name = "ContactName")]
        public string Name { get; set; }
        [Column ]
        public string City { get; set; }
    }
}

//很简单,多几个与定义Attribute而已

3.2使DataContext与实体类关联之数据库关联 (DSQL实体与SQL数据库关联)

方法1:DataContext构造方法中,关联数据库 Context ctx =new DataContext("Seriver=xxx;database=xxx;uid=xx;password=xx");

方法2:IDbConntion方法

using System.Data.SqlClient;

IDbconnection con= new SqlConnection ("server=xxx;database=Northwind;uid=xxx;pwd=xxx" );

DataContext ctx=new DataContext(con);

3.3强类型的Context

3.4日志贡

3.5探究查询

3.6执行查询

3.7创建数据库

3.8使用DbDataReader数据源