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

推荐订阅源

S
SegmentFault 最新的问题
Spread Privacy
Spread Privacy
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
SecWiki News
SecWiki News
腾讯CDC
P
Privacy International News Feed
Webroot Blog
Webroot Blog
J
Java Code Geeks
爱范儿
爱范儿
A
About on SuperTechFans
S
Secure Thoughts
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
DataBreaches.Net
Cloudbric
Cloudbric
Security Archives - TechRepublic
Security Archives - TechRepublic
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Security Latest
Security Latest
Forbes - Security
Forbes - Security
小众软件
小众软件
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threatpost
量子位
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Google Online Security Blog
Google Online Security Blog
云风的 BLOG
云风的 BLOG
GbyAI
GbyAI
S
Security @ Cisco Blogs
T
The Exploit Database - CXSecurity.com
Help Net Security
Help Net Security
V
Visual Studio Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 聂微东
P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs

博客园 - buru

django begining Update 两个表之间更新数据问题 用户控件与应用页面的事件顺序 linq小问题总结 “尝试读取或写入受保护的内存”错误处理 firefox浏览器的默认事件 配置rails运行环境 通过c#和ironruby学习 ruby语言 SQL 语句查询与性能 操作Access数据库碰到的几个问题 zz天涯-关于职业生涯的 一个线程管理器 zz两个存储过程 看《C#线程参考手册》 Mediator 中介者模式 让firefox支持IE的一些属性 IE与firefox取得事件对象的函数(zz) proxy模式 c#通过url获取文件
asp.net的CodeDom
buru · 2007-12-20 · via 博客园 - buru

2007-12-20 00:42  buru  阅读(223)  评论()    收藏  举报

asp.net2.0的编译模型很灵活,可以用自定义的BuildProvider解析特定的文件编译。
像asp.net里的master页面,.ashx,.ascx 以及.aspx的页面都由特定的buildprovider解析;
晚上自己试验了一下,做了个ORM映射的demo;
在网站的App_Code 下添加个文件demo.dbconfig(扩展名任意)是xml格式的

Code

自己建个类继承System.Web.BuildProvider来解析这个文件,让asp.net 知道怎么生成一个类。
生成的类是用表的字段名作为属性.

Code

网站添加这个BuilProvider引用,还要在webconfig里添加这个配置。

 <system.web>
     
    
        
<compilation debug="true">
            
<buildProviders >
                
<add extension=".dbconfig"   type="Samples.OrmBuildProvider,MyBuilder"/>
            
</buildProviders>
        
</compilation>
       
        
<authentication mode="Windows" />
    

    
</system.web>

完了之后,
在asp.net临时文件夹下生成的.cs文件为

还能被VS智能感知到 ,很cool吧。

调试的时候发现动态编译时查询了两次数据库。
源码下载(vs2008下打开)