<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://monobook.org/w/index.php?action=history&amp;feed=atom&amp;title=Fluent_NHibernate%2F%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E6%8E%A5%E7%B6%9A%E8%A8%AD%E5%AE%9A</id>
	<title>Fluent NHibernate/データベース接続設定 - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://monobook.org/w/index.php?action=history&amp;feed=atom&amp;title=Fluent_NHibernate%2F%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E6%8E%A5%E7%B6%9A%E8%A8%AD%E5%AE%9A"/>
	<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=Fluent_NHibernate/%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E6%8E%A5%E7%B6%9A%E8%A8%AD%E5%AE%9A&amp;action=history"/>
	<updated>2026-06-05T20:34:08Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://monobook.org/w/index.php?title=Fluent_NHibernate/%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E6%8E%A5%E7%B6%9A%E8%A8%AD%E5%AE%9A&amp;diff=2426&amp;oldid=prev</id>
		<title>2012年7月8日 (日) 06:10にimported&gt;Administratorによる</title>
		<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=Fluent_NHibernate/%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E6%8E%A5%E7%B6%9A%E8%A8%AD%E5%AE%9A&amp;diff=2426&amp;oldid=prev"/>
		<updated>2012-07-08T06:10:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2012年7月8日 (日) 06:10時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;1行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;1行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Fluent &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;NHibernateのデータベース接続設定には、FluentNHibernate&lt;/del&gt;.Cfg名前空間、およびFluentNHibernate.Cfg.Db名前空間にあるクラス群を用いる。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[&lt;/ins&gt;Fluent &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;NHibernate]]の&#039;&#039;&#039;データベース接続設定&#039;&#039;&#039;には、FluentNHibernate&lt;/ins&gt;.Cfg名前空間、およびFluentNHibernate.Cfg.Db名前空間にあるクラス群を用いる。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Fluent NHibernate]]の主要機能のひとつであるエンティティおよびマッピングからのスキーマ自動生成（テーブルなどの自動生成）に関する設定もここで行う。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== ドライバー ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== ドライバー ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Administrator</name></author>
	</entry>
	<entry>
		<id>https://monobook.org/w/index.php?title=Fluent_NHibernate/%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E6%8E%A5%E7%B6%9A%E8%A8%AD%E5%AE%9A&amp;diff=2425&amp;oldid=prev</id>
		<title>imported&gt;Administrator: ページの作成：「Fluent NHibernateのデータベース接続設定には、FluentNHibernate.Cfg名前空間、およびFluentNHibernate.Cfg.Db名前空間にあるクラス群を用い...」</title>
		<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=Fluent_NHibernate/%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E6%8E%A5%E7%B6%9A%E8%A8%AD%E5%AE%9A&amp;diff=2425&amp;oldid=prev"/>
		<updated>2012-07-08T05:29:10Z</updated>

		<summary type="html">&lt;p&gt;ページの作成：「Fluent NHibernateのデータベース接続設定には、FluentNHibernate.Cfg名前空間、およびFluentNHibernate.Cfg.Db名前空間にあるクラス群を用い...」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Fluent NHibernateのデータベース接続設定には、FluentNHibernate.Cfg名前空間、およびFluentNHibernate.Cfg.Db名前空間にあるクラス群を用いる。&lt;br /&gt;
&lt;br /&gt;
== ドライバー ==&lt;br /&gt;
Fluent NHibernateには各種データベースの接続用ドライバーも含まれているので、大半のデータベースは接続設定だけすれば動く。&lt;br /&gt;
&lt;br /&gt;
接続設定にはIPersistenceConfigurerインターフェイスを実装したクラスを用いる。&lt;br /&gt;
デフォルトではFluentNHibernate.Cfg.Db名前空間に以下のクラスが用意されている。&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! クラス !! RDBMS&lt;br /&gt;
|-&lt;br /&gt;
| DB2Configuration || [[DB2]]&lt;br /&gt;
|-&lt;br /&gt;
| FirebirdConfiguration || [[Firebird]]&lt;br /&gt;
|-&lt;br /&gt;
| IfxDRDAConfiguration || &lt;br /&gt;
|-&lt;br /&gt;
| IfxOdbcConfiguration || [[ODBC]]&lt;br /&gt;
|-&lt;br /&gt;
| IfxSQLIConfiguration || &lt;br /&gt;
|-&lt;br /&gt;
| IngresConfiguration || [[Ingres]]&lt;br /&gt;
|-&lt;br /&gt;
| JetDriverConfiguration || [[Jetデータベースエンジン]]（昔の[[Access]]など,[[Excel]]でも使える）&lt;br /&gt;
|-&lt;br /&gt;
| MsSqlCeConfiguration || [[SQL Server CE]]&lt;br /&gt;
|-&lt;br /&gt;
| MsSqlConfiguration || [[SQL Server]]&lt;br /&gt;
|-&lt;br /&gt;
| MySQLConfiguration || [[MySQL]]&lt;br /&gt;
|-&lt;br /&gt;
| OracleClientConfiguration || [[Oracle]]？他との違いは知らない。&lt;br /&gt;
|-&lt;br /&gt;
| OracleConfiguration || [[Oracle]]？他との違いは知らない。&lt;br /&gt;
|-&lt;br /&gt;
| OracleDataClientConfiguration || [[Oracle]]？他との違いは知らない。&lt;br /&gt;
|-&lt;br /&gt;
| PostgreSQLConfiguration || [[PostgreSQL]]&lt;br /&gt;
|-&lt;br /&gt;
| SQLAnywhereConfiguration || &lt;br /&gt;
|-&lt;br /&gt;
| SQLiteConfiguration || SQLite&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== MySQL ==&lt;br /&gt;
[[Fluent NHibernate]]による[[MySQL]]の接続設定の例を示す。&lt;br /&gt;
&lt;br /&gt;
なお、この例ではホスト名やユーザー名、パスワードなどのMySQL接続設定は[[アプリケーション構成ファイル]]のConnectionStringsに記載されたものを使う。&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using FluentNHibernate;&lt;br /&gt;
using FluentNHibernate.Cfg;&lt;br /&gt;
using FluentNHibernate.Cfg.Db;&lt;br /&gt;
using NHibernate;&lt;br /&gt;
using NHibernate.Tool.hbm2ddl;&lt;br /&gt;
&lt;br /&gt;
public class SampleApp&lt;br /&gt;
{&lt;br /&gt;
    public void Main(string[] args)&lt;br /&gt;
    {&lt;br /&gt;
        // MySQLの場合&lt;br /&gt;
        var dbConfig = MySQLConfiguration&lt;br /&gt;
            .Standard&lt;br /&gt;
            .ConnectionString(cs =&amp;gt; cs.FromConnectionStringWithKey(&amp;quot;db&amp;quot;))&lt;br /&gt;
            ;&lt;br /&gt;
        // 多くのサンプルでは↑と↓をメソッドチェーンで合体させて記述してあることが多い。&lt;br /&gt;
        // そのような書き方は個人的にはあまり好きではない。&lt;br /&gt;
        var fnConfig = Fluently.Configure()&lt;br /&gt;
            .Database(dbConfig)&lt;br /&gt;
            ;&lt;br /&gt;
        var factory = fnConfig.BuildSessionFactory();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
あまりお勧めできる方法ではないが、[[アプリケーション構成ファイル]]ではなく、[[MySQL]]の接続設定を直接[[ソースコード]]に埋め込む方法もある。&lt;br /&gt;
独自の設定ファイルを用いる場合にはこの方法を使うのもありかもしれない。&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
var dbConfig = MySQLConfiguration&lt;br /&gt;
    .Standard&lt;br /&gt;
    .ConnectionString(cs =&amp;gt; cs&lt;br /&gt;
        .Server(&amp;quot;127.0.0.1&amp;quot;)&lt;br /&gt;
        .Username(&amp;quot;user_name&amp;quot;)&lt;br /&gt;
        .Password(&amp;quot;pasword&amp;quot;)&lt;br /&gt;
        .Database(&amp;quot;database_name&amp;quot;)&lt;br /&gt;
    )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SQLite ==&lt;br /&gt;
[[Fluent NHibernate]]による[[SQLite]]の接続設定の例を示す。&lt;br /&gt;
[[Fluent NHibernate]]の公式サイトにあるサンプルはほぼSQLiteを使用しているので、公式サイトを見て回った方が早いかもしれない。&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
var dbConfig = SQLiteConfiguration&lt;br /&gt;
    .Standard&lt;br /&gt;
    .UsingFile(&amp;quot;firstProject.db&amp;quot;) // SQLiteファイルのパスを指定する。&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 関連項目 ==&lt;br /&gt;
* [[Fluent NHibernate]]&lt;br /&gt;
&lt;br /&gt;
== 参考文献 ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 外部リンク ==&lt;br /&gt;
&lt;br /&gt;
{{stub}}&lt;/div&gt;</summary>
		<author><name>imported&gt;Administrator</name></author>
	</entry>
</feed>