如何映射布尔与FluentNhibernate和SQLite [英] How to map boolean with FluentNhibernate and SQLite

查看:160
本文介绍了如何映射布尔与FluentNhibernate和SQLite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我明白我需要在SQLite的保存布尔值,整数,真/假的1/0,我猜。但是,这是怎么在映射文件中做了什么?

I understand I need to save boolean in SQLite as Integer, True/False as 1/0 I guess. But how is this done in the mapping file?

我是否需要写一些自定义映射约定类?我从来没有这样做过,所以将是非常有益的,如果有人可以提供一个例子。

Do I need to write some custom mapping convention class? I've never done this before, so would be very helpful if someone could offer an example.

推荐答案

您可以映射它像任何其他财产。在幕后发生转换。所以,如果您的单位有类似

You can map it like a any other property. Conversion happens under the covers. So if your entity has something like

public virtual bool IsArchived { get; set; }

该地图文件中查找该属性将有一个像这样的项目

the Map file for this property would have an entry like so

Map(x => x.IsArchived);

这篇关于如何映射布尔与FluentNhibernate和SQLite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆