question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extend AuditBehavior

See original GitHub issue

Hi, I need a dynamic behavior in Audit.WCF, That is: one service must to audit to X table, and other service to Y table. I want them to use in a differents attributes, something like this:

public class AuditMainApp : AuditBehaviorAttribute { protected override object CreateBehavior() { (CurrentAuditScope.DataProvider as SqlDataProvider).TableName = "AuditEvent_App"; return base.CreateBehavior(); } }

but the AuditBehaviorAttribute is sealed there is another nice way to do that?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
thepirat000commented, Dec 17, 2017

That’s not the way to go. You should not change the tablename of the sql data provider because it will be shared among threads.

You have some ways to accomplish what you want, for example creating a custom data provider that wraps different instances of the sqldataprovider, one for each table.

But since what you’re asking sounds familiar, I will better enhance the SqlDataProvider to allow changing the parameters dynamically. For example, instead of setting a TableName as a string, you could set a TableNameBuilder that is a function of the audit event, so you can for example use the EventType (or whatever you want) to define the table name per event:

    Configuration.Setup().UseSqlServer(config => config
        .TableNameBuilder(ev => ev.EventType)
        ...);

And on your service:

[AuditBehavior(EventType = "AuditEvent_App")]
public class OrderService : IOrderService
{
  ...
}

Will work on this enhancement and let you know.

0reactions
ShoshanaTzicommented, Dec 17, 2017

Working good! Thank’s for the most quicly response I got…

Read more comments on GitHub >

github_iconTop Results From Across the Web

IRS Audits | Internal Revenue Service
An IRS audit is a review/examination of an organization's or individual's accounts and financial information to ensure information is reported correctly ...
Read more >
IRS Can Audit for Three Years, Six, or Forever: Here's How ...
On the other hand, if you file late and do not have an extension, the statute runs three years following your actual (late)...
Read more >
Advanced security audit policy settings (Windows 10)
These advanced audit policy settings allow you to select only the behaviors that you want to monitor. You can exclude audit results for...
Read more >
Key behaviors of an agile-minded internal audit leader
#1. Agile-minded IA leaders build rapid feedback loops · Undertake rapid feedback loops with stakeholders (audit committee, senior management, ...
Read more >
IRS Audits Few Millionaires But Targeted Many Low-Income ...
“The IRS correspondence audit process is structured to expend the least amount of resources to conduct the largest number of examinations ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found