キャッスルの自動取引管理機能については、セッションをフラッシュせずに実際にデータベースに保存する操作を取得するのが難しいです。キャッスルの自動取引管理機能については、恒久的な問題
私は、次のコンポーネント * NHibernate.dll v3.1.0.4000 * Castle.Core.dll v2.5.2.0 * Castle.Windsor.dll v2.5.3.0 * Castle.Facilitiesを使用しています.NHibernateIntegration.dllのv1.1.0.0 * Castle.Services.Transaction.dll v2.5.0.0 * Castle.Facilities.AutoTx.dll私は非常に密接に城のドキュメントに従っている
v2.5.1.0と私の問題を解決できませんでした。
My(web-)アプリケーションがMVPパターンに従います。
<Transactional()> _
Public Class CampusEditPresenter
Inherits BasePresenter(Of ICampusEditView)
Public Sub New(ByVal view As ICampusEditView)
MyBase.New(view)
End Sub
...
<Transaction(TransactionMode.Requires)> _
Public Overridable Sub Save() Implements ICampusEditPresenter.Save
' Simplified
Using session As ISession = _sessionManager.OpenSession()
Dim campus As New Campus()
campus.Code = _view.Code
campus.ShortDescription = _view.ShortDescription
campus.LongDescription = _view.LongDescription
campus.StartDate = _view.StartDate
campus.EndDate = _view.EndDate
session.Save(campus)
End Using
End Sub
End Class
このプレゼンターサービスインストーラに登録されている:(ベースで)ビューによって
container.Register(_
Component.For(Of CampusEditPresenter) _
.Interceptors(Of DebugLoggingInterceptor) _
.LifeStyle.Transient)
と解決(トランザクション)プレゼンターサービスの主要な部分を以下に示します。
次のように私は、XML設定ファイルでNHibernateのとトランザクション施設を登録しているPublic Class BasePage(Of TPresenter)
Inherits Page
Protected _presenter As TPresenter
...
Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Init
_presenter = _container.Resolve(Of TPresenter)(New With {Key .view = Me})
End Sub
...
End Class
Public Class CampusEdit
Inherits BasePage(Of CampusEditPresenter)
Implements ICampusEditView
...
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click
_presenter.Save()
End Sub
...
End Class
:
<facility id="transaction" type="Castle.Facilities.AutoTx.TransactionFacility, Castle.Facilities.AutoTx" />
<facility id="nhibernate" type="Castle.Facilities.NHibernateIntegration.NHibernateFacility, Castle.Facilities.NHibernateIntegration" isWeb="true" configurationBuilder="[removed].AutoConfigurationBuilder, [removed]">
<factory id="nhibernate.factory">
<settings>
<item key="connection.driver_class">NHibernate.Driver.OracleClientDriver, NHibernate</item>
<item key="connection.connection_string">[removed]</item>
<item key="show_sql">false</item>
<item key="dialect">NHibernate.Dialect.Oracle10gDialect, NHibernate</item>
<item key="query.substitutions">true 1, false 0, yes 'Y', no 'N'</item>
<item key="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</item>
<item key="current_session_context_class">web</item>
<item key="hbm2ddl.keywords">auto-quote</item>
</settings>
</factory>
</facility>
と私は私のWeb.configファイルにSessionWebModule HTTPモジュールを登録している:なぜこれが動作していないことによう
<httpModules>
<add name="NHibernateSessionWebModule" type="Castle.Facilities.NHibernateIntegration.Components.Web.SessionWebModule, Castle.Facilities.NHibernateIntegration"/>
...
</httpModules>
任意のアイデア?
私はa)自分自身のトランザクションをISessionインスタンスからインスタンス化してこれらのトランザクションをコミットするか、またはb)自動トランザクション管理AOPメカニズムを使用してセッションインスタンスをフラッシュする手動でこれを行う必要はありません)。
私が経験していた
はチェックし、それらを介して起動時およびループにカーネルからすでに利用可能なハンドラを取得することです。あなたが手助けする時間があれば、私は非常に感謝しています:) – Henrik
ええええええええええええええええええええええええええええええええええええええええええええええええええん: –
https://github.com/haf/Castle.Transactions 「開発」ブランチに対していくつかの開発を行い、プルリクエストを送信する;)。 – Henrik