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

推荐订阅源

Engineering at Meta
Engineering at Meta
博客园_首页
H
Help Net Security
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
B
Blog
I
InfoQ
SecWiki News
SecWiki News
T
Tailwind CSS Blog
Spread Privacy
Spread Privacy
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
P
Palo Alto Networks Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Vercel News
Vercel News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
Kaspersky official blog
M
MIT News - Artificial intelligence
S
Schneier on Security
T
Threat Research - Cisco Blogs
F
Fortinet All Blogs
Cyberwarzone
Cyberwarzone
Scott Helme
Scott Helme
aimingoo的专栏
aimingoo的专栏
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
The Cloudflare Blog
Recent Announcements
Recent Announcements
Security Latest
Security Latest
G
GRAHAM CLULEY
IT之家
IT之家
Y
Y Combinator Blog
The Last Watchdog
The Last Watchdog
腾讯CDC
Google DeepMind News
Google DeepMind News
V
V2EX
S
Securelist
TaoSecurity Blog
TaoSecurity Blog
B
Blog RSS Feed
S
SegmentFault 最新的问题
博客园 - 叶小钗
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
Project Zero
Project Zero
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
F
Full Disclosure

博客园 - InterMa

离开了。。。 安装ubuntu6.06的一个应注意之处 - InterMa - 博客园 今天和同学们包饺子啦~ - InterMa - 博客园 。。。。。。 关于ODR和Template 第3方client连接talk.google.com的一些注意之处 王国维 之 三境界 给俱乐部中的朋友们问个好~ :-) 函数调用与堆栈清理 使用Castle ActiveRecord的几点小经验 拳脚小功夫,容人大丈夫 No Touch Required 一些页面配色的资源【存档自用】 Vim7下配置C/C++的Omni complete Vim7下配置Python的Omni complete Richard Stallman和自由软件运动 扯2,3事 写了一个Google登陆风格的table 最近正在FPS。。。
Castle ActiveRecord中ntext类型的映射
InterMa · 2006-11-28 · via 博客园 - InterMa

Posted on 2006-11-28 18:47  InterMa  阅读(2760)  评论()    收藏  举报

上半年弄了一个小的MIS系统,使用了Castle AR(for .net2.0, beta 3),其中一个类中有一个映射到ntext(sql server2000)的属性,发现最多只能存储进4000个unicode字符,当时研究了一下原因就是NHibernate默认String类型为nvarchar,save()的时候于是就被自动截断了,当时比较懒同时考虑4000个字符可能也够了(侥幸心理),就没管它。。。

后来客户每次见了我都问:“你那个程序能不能改一下,让它可以多输入一些字符,我们要%……¥%◎#¥(省略n字)”,昨天早上被客户电话吵醒,还是这个问题,终于受不了了,于是搜了一下,找到如下解决方案:

如果只是使用NHibernate的话,只要在映射文件中指定一下sql-type为ntext就可以了,但是AR给NHibernate包了一下,就没法用映射文件了,同时AR(beta 3)的[Property]特性中也没有sql-type参数,=.=
郁闷之余去了Castle官网,发现Castle已经RC2了(其中AR为RC1),然后看了一下PropertyAttribute属性文档,发觉sql-type已经加入了,这下容易了,原代码改成这样就可以了(注意ColumnType和SqlType):

    [Property("context", ColumnType = "StringClob", SqlType = "ntext")]
    
public string Context
    {
        
get { return this.context; }
        
set { this.context = value; }
    }


然后用AR RC1的dll替换原来beta3的,一切搞定,终于可以不用忍受客户的。。。(但愿如此)