@@ -29,7 +29,7 @@ foreach(var entry in entries)
2929}
3030
3131```
32- {% include component-try-it.html href='https://dotnetfiddle.net/MBHlX8 ' %}
32+ {% include component-try-it.html href='https://dotnetfiddle.net/AJVhpP ' %}
3333
3434## AutoSave Audit
3535
@@ -65,6 +65,7 @@ audit.CreatedBy = "ZZZ Projects"; // Optional
6565ctx .SaveChanges (audit );
6666
6767```
68+ {% include component-try-it.html href='https://dotnetfiddle.net/BfkqWm ' %}
6869
6970*** By using a different context***
7071
@@ -95,6 +96,7 @@ audit.CreatedBy = "ZZZ Projects"; // Optional
9596oracleContext .SaveChanges (audit );
9697
9798```
99+ {% include component-try-it.html href='https://dotnetfiddle.net/wTwh77 ' %}
98100
99101*** Custom AuditEntry & Database First Approach***
100102
@@ -104,7 +106,7 @@ oracleContext.SaveChanges(audit);
104106AuditManager .DefaultConfiguration .AutoSavePreAction = (context , audit ) =>
105107{
106108 // ADD "Where(x => x.AuditEntryID == 0)" to allow multiple SaveChanges with same Audit
107- var customAuditEntries = audit .Entries .Select (x => Import (x ));
109+ var customAuditEntries = audit .Entries .Select (x => (( EntityContext ) context ). Import (x ));
108110 (context as Entities ).AuditEntries .AddRange (customAuditEntries );
109111};
110112
@@ -117,7 +119,7 @@ using (var ctx = new Entities())
117119 ctx .SaveChanges (audit );
118120}
119121
120- public AuditEntry Import (Z .EntityFramework .Plus .AuditEntry entry )
122+ public Static AuditEntry Import (Z .EntityFramework .Plus .AuditEntry entry )
121123{
122124 var customAuditEntry = new AuditEntry
123125 {
@@ -134,7 +136,7 @@ public AuditEntry Import(Z.EntityFramework.Plus.AuditEntry entry)
134136 return customAuditEntry ;
135137}
136138
137- public AuditEntryProperty Import (Z .EntityFramework .Plus .AuditEntryProperty property )
139+ public Static AuditEntryProperty Import (Z .EntityFramework .Plus .AuditEntryProperty property )
138140{
139141 var customAuditEntry = new AuditEntryProperty
140142 {
@@ -148,6 +150,7 @@ public AuditEntryProperty Import(Z.EntityFramework.Plus.AuditEntryProperty prope
148150}
149151
150152```
153+ {% include component-try-it.html href='https://dotnetfiddle.net/9XjCSM ' %}
151154
152155*** Saving automatically by overriding SaveChanges & SaveChangesAsync***
153156
@@ -207,6 +210,7 @@ using(var ctx = new EntityContext())
207210}
208211
209212```
213+ {% include component-try-it.html href='https://dotnetfiddle.net/TFf8aj ' %}
210214
211215*** SQL Script (for Database First)***
212216
0 commit comments