【问题标题】:Index Prefix Length for BLOB with Nhibernate and MySQL使用 Nhibernate 和 MySQL 的 BLOB 的索引前缀长度
【发布时间】:2012-02-08 00:35:15
【问题描述】:

在我的数据模型中有一个带有byte[] Hash 属性的类,它被翻译成BLOB。我希望此列/属性是唯一的。

根据这个 MySQL 手册 page,我需要为 BLOB 指定索引前缀长度,否则它不允许在 BLOB 上建立索引。

CREATE TABLE test (blob_col BLOB, INDEX(blob_col(10)));

在 (Fluent) NHibernate 中我该怎么做?

谢谢

【问题讨论】:

    标签: c# mysql nhibernate fluent-nhibernate nhibernate-mapping


    【解决方案1】:

    hbm.xml 文件或字符串中的数据库对象和new Configuration.Configure().Add()

    http://ayende.com/blog/3947/nhibernate-mapping-database-object

    【讨论】:

    • 谢谢。编程方式是调用new Configuration.Configure().AddAuxiliaryDatabaseObject(IAuxiliaryDatabaseObject)。为方便起见,有一个SimpleAuxiliaryDatabaseObject
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-10-10
    • 2013-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-22
    • 2013-02-15
    相关资源
    最近更新 更多