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

推荐订阅源

V
Vulnerabilities – Threatpost
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
云风的 BLOG
云风的 BLOG
N
Netflix TechBlog - Medium
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Archives - TechRepublic
Security Archives - TechRepublic
P
Privacy International News Feed
F
Full Disclosure
P
Proofpoint News Feed
The Hacker News
The Hacker News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
The Blog of Author Tim Ferriss
T
Threatpost
L
Lohrmann on Cybersecurity
I
Intezer
S
SegmentFault 最新的问题
小众软件
小众软件
T
Threat Research - Cisco Blogs
MongoDB | Blog
MongoDB | Blog
美团技术团队
NISL@THU
NISL@THU
罗磊的独立博客
N
News | PayPal Newsroom
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园 - 聂微东
W
WeLiveSecurity
Microsoft Security Blog
Microsoft Security Blog
阮一峰的网络日志
阮一峰的网络日志
Scott Helme
Scott Helme
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
TaoSecurity Blog
TaoSecurity Blog
A
Arctic Wolf
P
Privacy & Cybersecurity Law Blog
Attack and Defense Labs
Attack and Defense Labs
I
InfoQ
Microsoft Azure Blog
Microsoft Azure Blog
S
Securelist
D
Darknet – Hacking Tools, Hacker News & Cyber Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Schneier on Security
Schneier on Security
Know Your Adversary
Know Your Adversary
人人都是产品经理
人人都是产品经理
The Register - Security
The Register - Security
U
Unit 42
The Cloudflare Blog
T
Tenable Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Recent Announcements
Recent Announcements
D
DataBreaches.Net
量子位

博客园 - 155144

GridView和DataFormatString 32.DataReader和output参数的问题 31.动态SQL中使用变量时,可使用存储过程sp_executesql 【求解算法的时间复杂度的具体步骤】 【指数与对数】 30.一个自定义32进制类初稿 【SQL行转列】 29.DataReader相关 【经典SQL语句 】 28.Lc.exe 已退出,代码 -1 27.PowerDesigner中Stereotype的创建 26.UML笔记(UML2.0设计手册) 25.VSS相关 24.GRIDVIEW相关 23.DOTNET中引用相关 21-ReSharper UnitRun for .net 20-系统分析与设计(第5版) 19-关于用例的几点知识——摘自《道法自然》 18-概念性系统设计
22.使用Castle时,如何获取自定义类的单个属性的PropertyAttribute.Column
155144 · 2008-05-21 · via 博客园 - 155144

    最近看了下Castle,其中在自定义类时加了很多特性,用于实现实体与数据库表的关联.
    因为对特性接触不多,所以不知道怎么使用.现在找到答案了;)记录下来.

例如:
可以通过如下方法获取属性Id的特性:
BugETT be = new BugETT();
(TypeDescriptor.GetProperties(be)["Id"].Attributes[typeof(PropertyAttribute)]  as PropertyAttribute).Column 

感谢 Colin Han 提供的答案.

 /////////////////////////////////////////////
自定义类: 

    [ActiveRecord("TB_BUG")]
    public class BugETT
    {
        
        private Int32 m_Id;
        

        public BugETT(){}


        [Property("BUG_ID")]
        public Int32 Id
        {
            get { return m_Id; }
            set { m_Id = value; }
        }

}
////////////////////////////////////

_____________________________________________________________________________________
COPYRIGHT©2008,HTTP://ZEROBUG.CNBLOGS.COM .ALL RIGHTS RESERVED.