code_junkie

Using Linq to SQL and Sql Reporting Services

Nov 13th, 2011
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. public class DataBase : DataBaseModelDataContext
  2. {
  3. internal DataBase()
  4. {
  5. }
  6.  
  7. public DataBase(CommonObjects.BaseParameters param) {
  8. #If (DEBUG)
  9. Log = new DataBaseLoger();
  10. #endIf //(DEBUG)
  11. }
  12.  
  13. public override void SubmitChanges(System.Data.Linq.ConflictMode failureMode)
  14. {
  15. System.Data.Linq.ChangeSet cs = GetChangeSet();
  16.  
  17. // update audit fields for each insert
  18. foreach (object entity in cs.Inserts)
  19. {
  20. UpdateAuditFields(entity);
  21. }
  22.  
  23. // update audit fields for each update
  24. foreach (object entity in cs.Updates)
  25. {
  26. UpdateAuditFields(entity);
  27. }
  28.  
  29. base.SubmitChanges(failureMode);
  30. }
  31. }
  32.  
  33. public override void WriteLine(string value)
  34. {
  35. System.Diagnostics.Trace.WriteLine(System.DateTime.Now.ToString("hh:mm:ss") + " " + value, "Information");
  36. }
  37.  
  38. public override void WriteLine()
  39. {
  40. System.Diagnostics.Trace.WriteLine("", "Information");
  41. }
  42.  
  43. public override void WriteLine(string format, params object[] arg)
  44. {
  45. WriteLine(string.Format(format, arg));
  46. }
  47. }
Add Comment
Please, Sign In to add comment