This project is read-only.

Auditing and Time-stamps for MySQL

Nov 3, 2012 at 7:36 PM

Using MySQL, I have successfully worked out auditing for CreatedDate and ModifiedDate however, I am confused how to work out User Auditing for CreatedBy and ModifiedBy. And also, it seems using Timestamp for MySQL doesn't work. 

I tried following the instructions on this link to no avail.

Nov 4, 2012 at 9:13 PM

First, the timestamp field has been overridden to work like SQL Server. It is a blob binary field that is managed and not editable from the API. When I run the code below I get a record entered into my database with a createdby and modifiedby setting of "user1". This is by design. Please tell me what does not work in your example.

var startup = new ContextStartup("user1", DatabasePlatformConstants.MySql);
using (var context = new MySql43Entities(startup, "server=localhost;database=mysqldb;user id=root;password=mypassword"))
var newItem = new Entity1();
newItem.Name = "qqq";
context.AddItem(newItem); context.SaveChanges();

Nov 4, 2012 at 9:52 PM

As for the Audit by User, for ModifiedBy and CreatedBy, I got them to work. Thank you very much! 

So I just enabled timestamps. However, they are 0 valued. Is this normal? The design is in the link