Log file of all transaction
I use SP
and linq
and Function
for work to SQL Server 2005
I want to any connection to DB.
The DB added that the information be deleted or edited or added(to DB) in a text file(log) or do anything to follow events held in the DB.
how can this work by SQL or asp.net
开发者_如何学编程I like in any connection to DB save input/output connection
input:arguman that send to DB
output:DB Return or edit or delete recorded in DB
The question is a little hard to follow, but if you simply want to log all LINQ access to the DB, then with something like LINQ-to-SQL you could use DataContext.Log
and specify a writer (be careful though - don't give it the file directly, as you'll block parallel activity).
I personally think this is a bad idea though - data volume is usually prohibitive for this. Databases get very busy.
If that isn't sufficient, and you have other operations to log - you could try an intercepting DbConnection, a bit like the profiled connection in mvc-mini-profiler. This works well with LINQ-to-SQL (EF... harder). But again - data volume is a big issue here.
Create your own small API like OpenDBConnection(); CloseDBConnection(); and use it all arround the code inyour C# program . Add log functionality to that methods and you basically done.
As @Marc says the amount of the data is one of the problems here not actually an implementation, but it depends on current and future scale of your project that only you may know.
Hope this helps.
Regards.
精彩评论