Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, so this isn't exactly how I imagined it would work but it has infact met my needs. Kind of!</p> <p>What I did was Write a Protected Sub in the code behind file of the aspx file.</p> <pre><code>Protected Sub CustomEntityUpdate_Employee(sender As Object, e As EntityDataSourceChangingEventArgs) Dim emp As CPMModel.Employee = e.Entity ' Check if the entity state is modified and update auditing columns If emp.EntityState = EntityState.Modified Then emp.FiledDateTimeStamp = Date.Now() emp.FiledBy = Threading.Thread.CurrentPrincipal.Identity.Name emp.FiledLocation = My.Computer.Name End If End Sub </code></pre> <p>Then in the aspx page I edited the Entity datasource code to call the above sub routine</p> <pre><code>#nUpdating="CustomEntityUpdate_Employee" &lt;asp:EntityDataSource ID="eds_Employee" runat="server" ConnectionString="name=CPMEntities" DefaultContainerName="CPMEntities" EnableFlattening="False" EnableUpdate="True" EntitySetName="Employees" AutoGenerateWhereClause="True" Where="" EntityTypeFilter="Employee" **OnUpdating="CustomEntityUpdate_Employee"&gt;** &lt;WhereParameters&gt; &lt;asp:SessionParameter Name="ID" SessionField="UserID" /&gt; &lt;/WhereParameters&gt; &lt;/asp:EntityDataSource&gt; </code></pre> <p>The Protected Sub, checks if the entity has been modified and if it has updates the entity auditing columns with the values I wanted.</p> <p>It works but it will certainly make for a lot more code, I ideally would like a way to package this up perhaps into a class and just call the sub from the various aspx pages via the OnUpdating event and have the class figure out which entity was making the call and handle all the logic there.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload