[dba-VB] CodeFirst, DataBinding and audit trailing deleted items on client side

Doug Steele dbdoug at gmail.com
Tue Apr 16 22:02:16 CDT 2013


Thank you for posting this, Shamil!

Doug


On Tue, Apr 16, 2013 at 7:12 PM, Salakhetdinov Shamil <mcp2004 at mail.ru>wrote:

>  Here is how the code posted in my two previous postings can be used with
> a test WinForm with one gridview bound to a DbSet< MyTestEntity> via
> BidingSource, three test buttons and one test textox. Previously posted and
> the following code is not used in production nor I plan to use it in
> production environment soon - this coding is more for learning purposes of
> CodeFirst approach (
> http://www.amazon.com/Programming-Entity-Framework-Code-First/dp/1449312942/ref=sr_1_2?ie=UTF8&qid=1366164644&sr=8-2&keywords=DbContext) and DbContext (
> http://www.amazon.com/Programming-Entity-Framework-Julia-Lerman/dp/1449312969/ref=sr_1_1?ie=UTF8&qid=1366164644&sr=8-1&keywords=DbContext).
>
> using System;
> using System.Windows.Forms;namespace TestWindowsFormsApplication1
> {
> public partial class TestForm : Form
> {
> public TestForm()
> {
> InitializeComponent();
> }
> private GenericEntityGridViewHandler<MyTestContainer, MyTestEntity>
> _handler;
> private void Form1_Load(object sender, EventArgs e)
> {
> string sql = "select * from MyTestEntity order by [Name] ASC";
> _handler = new GenericEntityGridViewHandler<MyTestContainer,
> MyTestEntity>(myTestEntityDataGridView, myTestEntityBindingSource, sql);
> _handler.LoadData();
> }
> private void cmdSaveAll_Click(object sender, EventArgs e)
> {
> var report = _handler.SaveChanges();
> auditTrailReportTextBox.Text = "";
> foreach (var textLine in
> _handler.GetAuditTrailItemsTestReportString(report))
> {
> auditTrailReportTextBox.Text += textLine;
> }
> }
> private void cmdReloadData_Click(object sender, EventArgs e)
> {
> _handler.LoadData();
> }
> private void cmdReportCurrentAuditTrail_Click(object sender, EventArgs e)
> {
> auditTrailReportTextBox.Text = "";
> foreach (var textLine in
> _handler.GetAuditTrailItemsTestReportString(_handler.AuditTrailItems ) )
> {
> auditTrailReportTextBox.Text += textLine;
> }
> }
> }
> } Thank you.
>
> -- Shamil
>
>
> Среда, 17 апреля 2013, 5:39 +04:00 от Salakhetdinov Shamil <
> mcp2004 at mail.ru>:
> >Hi Scott --
> >
> >Thank you for your sample. I have prepared mine, which I will post here
> in several subsequent posts as one posting limit is 20KB.
> >
> >By "individual changes" I mean *all* the data changes happened between
> data load and data saving, And I wanted to "capture" that individual data
> changes as soon as they happen not before .SaveChanges() call.
> <<< skipped >>>
> >
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
>
>


More information about the dba-VB mailing list