I don’t understand I’m afraid.
If you can isolate your problem, please post the code here (or even better – as 
a unit test).

The exception you get is because you’re trying to release a configuration 
object from Envers that it doesn’t know about.

From: [email protected] [mailto:[email protected]] On Behalf Of 
Atilla Ilhan KARTAL
Sent: den 30 maj 2014 08:59
To: [email protected]
Subject: Re: [nhusers] Nhibernate Envers Multiple Database Auditing

Dear Roger;

Thanks for Reply.

I am setting entity table catalog name with configuration at runtime. After 
settings re build the session factory.

My Senario.

1- Login (Login and user cridentals in Application Master Database and this 
database models mapping add)
2- Select Working Database (Database list in Application Master Database and 
working models mapping append configuration and set catalog name  after rebuild 
sessionfactory)
3- Session Create an use

For Example Query :

SELECT .......... FROM workingdb.phone P
INNER JOIN masterdb.user U ON (..............)

I am tested SetTableInfo method. I can successfully create audit table schema.

Master database audit accomplish but working database not auditing. I dont have 
a any exception. I think i need re integrate Envers.

I tested AuditConfiguration.Remove(cfg) but this method has exception.




[ArgumentNullException: Value cannot be null. ParameterName: key

   konum: System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   konum: System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& 
value)
   konum: NHibernate.Envers.Configuration.Store.MetaDataStore.ClassMeta[T](Type 
entityType)
   konum: 
NHibernate.Envers.Configuration.RevisionInfoConfiguration.nhMappedTypesWithRevisionEntityAttribute(Configuration
 cfg)
   konum: 
NHibernate.Envers.Configuration.RevisionInfoConfiguration.Configure(Configuration
 cfg)
   konum: 
NHibernate.Envers.Configuration.AuditConfiguration..ctor(Configuration cfg, 
IMetaDataProvider metaDataProvider)
   konum: 
NHibernate.Envers.Configuration.AuditConfiguration.GetFor(Configuration cfg)
   konum: 
NHibernate.Cfg.NhConfigurationExtension.IntegrateWithEnvers(Configuration 
configuration, AuditEventListener auditEventListener, IMetaDataProvider 
metaDataProvider)
   konum: 
NHibernate.Cfg.NhConfigurationExtension.IntegrateWithEnvers(Configuration 
configuration, IMetaDataProvider metaDataProvider)
   konum: 
ergatech.Data.SessionManagement.AbstractSessionManager.SetContextSchema(String 
contextName, String schema, Boolean openAudit) 
c:\Users\akartal\Documents\Visual Studio 
2012\Projects\Vireo\ergatech.Data\SessionManagement\AbstractSessionManager.cs 
içinde: satır 632
   konum: Vireo.Core.Systems.Database.Use() c:\Users\akartal\Documents\Visual 
Studio 2012\Projects\Vireo\Vireo.Core\Systems\Database.cs içinde: satır 74
   konum: Vireo.Client.Desktop.FrmDatabaseSelect.simpleButton1_Click(Object 
sender, EventArgs e) c:\Users\akartal\Documents\Visual Studio 
2012\Projects\Vireo\Vireo.Client.Desktop\FrmDatabaseSelect.cs içinde: satır 51
   konum: DevExpress.XtraEditors.BaseButton.OnClick(EventArgs e)
   konum: DevExpress.XtraEditors.BaseButton.OnMouseUp(MouseEventArgs e)
   konum: System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons 
button, Int32 clicks)
   konum: System.Windows.Forms.Control.WndProc(Message& m)
   konum: DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)
   konum: DevExpress.XtraEditors.BaseControl.WndProc(Message& msg)
   konum: System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, 
IntPtr wparam, IntPtr lparam)


2014-05-29 1:40 GMT+03:00 Roger Kratz 
<[email protected]<mailto:[email protected]>>:
Don't you mean at configuration time? If so, you can set audit catalog globally 
using nh prop nhibernate.envers.default_catalog
http://envers.bitbucket.org/#config-reference
If you want to set catalog name per audit entity, you can use SetTableInfo
https://bitbucket.org/RogerKratz/nhibernate.envers/raw/90f269d175a10bcf26226680106e08a289923a74/Src/NHibernate.Envers.Tests/NetSpecific/UnitTests/Fluent/TableNameTest.cs

If you do mean "setting entity catalog at runtime" like sometimes entity A 
should be persisted to X and sometimes to Y, I don't understand you. How should 
that work? What should decide this runtime decision?

/Roger



-------- Original message --------
>From Atilla İlhan KARTAL 
><[email protected]<mailto:[email protected]>>
Date: 2014/05/28 15:26 (GMT+01:00)
To [email protected]<mailto:[email protected]>
Subject [nhusers] Nhibernate Envers Multiple Database Auditing


Dear All;

I am using multiple database in my project. I am setting entity catalog at 
runtime.

For example query

SELECT ..... FROM catalogname.dbo.entity_table
JOIN othercatalogname.dbo.entity_table ON .....
.......


I want to make audit my data. I want to create audit tables in entity database. 
How can i set audit catalog at runtime?

Best regards


--
Atilla İlhan KARTAL
Web Application & Software Architect
(Java & PHP & Registered Android Developer)
Kuşadası / Aydın / Turkey
www.atillailhankartal.com.tr<http://www.atillailhankartal.com.tr><http://www.atillailhankartal.com.tr>
twitter.com/TrojanMyth<http://twitter.com/TrojanMyth><http://twitter.com/TrojanMyth>

--
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:nhusers%[email protected]><mailto:[email protected]<mailto:nhusers%[email protected]>>.
To post to this group, send email to 
[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>.
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:nhusers%[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.



--
Atilla İlhan KARTAL
Web Application & Software Architect
(Java & PHP & Registered Android Developer)
Kuşadası / Aydın / Turkey
www.atillailhankartal.com.tr<http://www.atillailhankartal.com.tr>
twitter.com/TrojanMyth<http://twitter.com/TrojanMyth>
--
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to