开发者

when nhibernate generates a schema, what about other indexes besides PK and FK

开发者 https://www.devze.com 2022-12-12 17:45 出处:网络
If I let nhibernate generate the schem开发者_C百科a, what about other indexes I may put on the tables for performance reasons?

If I let nhibernate generate the schem开发者_C百科a, what about other indexes I may put on the tables for performance reasons?

e.g. say I need to order by a datetime field allot, I may put a index on that column.


You can create a single-column unique index by specifying unique="true" in a class property's mapping.

You can create a multi-column unique index by giving each participating property the same unique-key="foo" value.

You can create a multi-column, non-unique index the same way, except the attribute to use is index="bar" instead of unique-key="foo".

Finally, for more complex cases, you can create the index inside a <database-object> element in the mapping file.

0

精彩评论

暂无评论...
验证码 换一张
取 消