Skip to content

Commit 79b1cc1

Browse files
Merge pull request #395 from Lempireqc/master
Add Fiddle
2 parents 1b2159c + 0f66afd commit 79b1cc1

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

docs2/pages/documentations/audit.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ foreach(var entry in entries)
2929
}
3030

3131
```
32+
{% include component-try-it.html href='https://dotnetfiddle.net/AJVhpP' %}
3233

3334
## AutoSave Audit
3435

@@ -64,6 +65,7 @@ audit.CreatedBy = "ZZZ Projects"; // Optional
6465
ctx.SaveChanges(audit);
6566

6667
```
68+
{% include component-try-it.html href='https://dotnetfiddle.net/BfkqWm' %}
6769

6870
***By using a different context***
6971

@@ -94,6 +96,7 @@ audit.CreatedBy = "ZZZ Projects"; // Optional
9496
oracleContext.SaveChanges(audit);
9597

9698
```
99+
{% include component-try-it.html href='https://dotnetfiddle.net/wTwh77' %}
97100

98101
***Custom AuditEntry & Database First Approach***
99102

@@ -116,7 +119,7 @@ using (var ctx = new Entities())
116119
ctx.SaveChanges(audit);
117120
}
118121

119-
public AuditEntry Import(Z.EntityFramework.Plus.AuditEntry entry)
122+
public Static AuditEntry Import(Z.EntityFramework.Plus.AuditEntry entry)
120123
{
121124
var customAuditEntry = new AuditEntry
122125
{
@@ -133,7 +136,7 @@ public AuditEntry Import(Z.EntityFramework.Plus.AuditEntry entry)
133136
return customAuditEntry;
134137
}
135138

136-
public AuditEntryProperty Import(Z.EntityFramework.Plus.AuditEntryProperty property)
139+
public Static AuditEntryProperty Import(Z.EntityFramework.Plus.AuditEntryProperty property)
137140
{
138141
var customAuditEntry = new AuditEntryProperty
139142
{
@@ -147,6 +150,7 @@ public AuditEntryProperty Import(Z.EntityFramework.Plus.AuditEntryProperty prope
147150
}
148151

149152
```
153+
{% include component-try-it.html href='https://dotnetfiddle.net/9XjCSM' %}
150154

151155
***Saving automatically by overriding SaveChanges & SaveChangesAsync***
152156

@@ -206,6 +210,7 @@ using(var ctx = new EntityContext())
206210
}
207211

208212
```
213+
{% include component-try-it.html href='https://dotnetfiddle.net/TFf8aj' %}
209214

210215
***SQL Script (for Database First)***
211216

@@ -284,6 +289,7 @@ public class EntitySimple : IEntitySimple
284289
}
285290

286291
```
292+
{% include component-try-it.html href='https://dotnetfiddle.net/QPcF2a' %}
287293

288294
**Example Enable DataAnnotations**
289295

@@ -326,6 +332,7 @@ audit.Configuration.Include<IAuditable>();
326332
ctx.SaveChanges(audit);
327333

328334
```
335+
{% include component-try-it.html href='https://dotnetfiddle.net/8TbEdO' %}
329336

330337
## Exclude & Include Property
331338

@@ -364,6 +371,7 @@ audit.Configuration.ExcludeProperty<IAuditable>(x =>
364371
ctx.SaveChanges(audit);
365372

366373
```
374+
{% include component-try-it.html href='https://dotnetfiddle.net/eHO1fP' %}
367375

368376
## Format Value
369377

@@ -394,6 +402,7 @@ audit.Configuration.Format<OrderItem>(x => x.Price,
394402
ctx.SaveChanges(audit);
395403

396404
```
405+
{% include component-try-it.html href='https://dotnetfiddle.net/Of9Dbz' %}
397406

398407
## Ignore Events
399408

@@ -430,6 +439,7 @@ audit.Configuration.IgnoreRelationshipDeleted = true;
430439
ctx.SaveChanges(audit);
431440

432441
```
442+
{% include component-try-it.html href='https://dotnetfiddle.net/Ya95EQ' %}
433443

434444
## Property Unchanged
435445

@@ -458,6 +468,7 @@ audit.Configuration.IgnorePropertyUnchanged = false;
458468
ctx.SaveChanges(audit);
459469

460470
```
471+
{% include component-try-it.html href='https://dotnetfiddle.net/tYE0YR' %}
461472

462473
## Soft Add & Soft Delete
463474

@@ -490,6 +501,7 @@ audit.Configuration.SoftDeleted<ISoftDelete>(x => x.IsDeleted);
490501
ctx.SaveChanges(audit);
491502

492503
```
504+
{% include component-try-it.html href='https://dotnetfiddle.net/OadxfN' %}
493505

494506
## Retrieve AuditEntries for specific item
495507

@@ -512,6 +524,7 @@ using (var ctx = new TestContext())
512524
}
513525

514526
```
527+
{% include component-try-it.html href='https://dotnetfiddle.net/ETFLlO' %}
515528

516529
### Audit, AuditEntry & AuditEntryProperty
517530

@@ -588,6 +601,7 @@ audit.Configuration.AuditEntryFactory = args =>
588601
ctx.SaveChanges(audit);
589602

590603
```
604+
{% include component-try-it.html href='https://dotnetfiddle.net/aVIC0C' %}
591605

592606
#### Custom Class
593607

@@ -616,6 +630,7 @@ audit.Configuration.AuditEntryPropertyFactory = args =>
616630
ctx.SaveChanges(audit);
617631

618632
```
633+
{% include component-try-it.html href='https://dotnetfiddle.net/xazeGj' %}
619634

620635
#### Custom DbSet with AutoSave
621636

@@ -683,6 +698,7 @@ public class CurrentContext : DbContext
683698
}
684699

685700
```
701+
{% include component-try-it.html href='https://dotnetfiddle.net/AREtca' %}
686702

687703
## Limitations
688704

@@ -713,4 +729,4 @@ Here is an example of this issue: [Issues #8](https://github.com/zzzprojects/Ent
713729

714730
Need help getting started? [[email protected]](mailto:[email protected])
715731

716-
We welcome all comments, ideas and suggestions to improve our library.
732+
We welcome all comments, ideas and suggestions to improve our library.

0 commit comments

Comments
 (0)