CSharpDev
CSharpDev

Reputation: 382

Suppress database logs for all DML transactions done using NHibernate

As you all know that whenever we execute any DML statement on Database, database all the time keeps its transaction logs for each of these statements. For e.g in the case of SQL Server each time database.ldf file is captured with these stuff in place and this is the great thing that we can retain our database in case of failure.

But in my case, I want to suppress these logs from my application using NHibernate(fluent).

Is that possible that I can tell my NHibernate object to not to store any transaction logs which were generating on to my database?

Thanks, Vijay

Upvotes: 1

Views: 55

Answers (1)

Frédéric
Frédéric

Reputation: 9864

Transaction logs are an internal implementation "detail" of databases, NHibernate has no knowledge of them and cannot manipulate them nor tell the db to not generate them.

You may instead issue database admin commands through ISession.CreateSQLQuery("some query truncating the logs").ExecuteUpdate() if your sql login allows this, and if you believe this is really a good thing.

But managing transaction logs is a database administrator task and responsibility, not an orm responsibility. Maybe should you ask another question about what leads you to try doing that, and how to solve it properly. Because what you want to do as a solution here looks quite wrong to me.

Upvotes: 1

Related Questions