EMIS.Entities.Log.Context.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was generated from a template.
  4. //
  5. // Manual changes to this file may cause unexpected behavior in your application.
  6. // Manual changes to this file will be overwritten if the code is regenerated.
  7. // </auto-generated>
  8. //------------------------------------------------------------------------------
  9. #pragma warning disable 1573
  10. namespace EMIS.Entities.Log
  11. {
  12. using System;
  13. using System.Data.Common;
  14. using System.Data.Entity;
  15. using System.Data.Entity.Infrastructure;
  16. using EntityFramework.Extensions;
  17. using System.Linq.Expressions;
  18. using System.Data.Entity.Core.Objects;
  19. public partial class EMISNewLogContext : DbContext
  20. {
  21. static EMISNewLogContext()
  22. {
  23. Database.SetInitializer<EMISNewLogContext>(null);
  24. }
  25. public EMISNewLogContext() : base("name=EMISNewLogContext") {
  26. var objectContext = (this as IObjectContextAdapter).ObjectContext;
  27. objectContext.CommandTimeout = 12000;
  28. base.Configuration.ProxyCreationEnabled = false;
  29. }
  30. public EMISNewLogContext(string nameOrConnectionString) : base(nameOrConnectionString) {
  31. var objectContext = (this as IObjectContextAdapter).ObjectContext;
  32. objectContext.CommandTimeout = 12000;
  33. base.Configuration.ProxyCreationEnabled = false;
  34. }
  35. protected void Delete<TEntity>(Expression<Func<TEntity, bool>> whereExpression) where TEntity : class
  36. {
  37. var context = ((IObjectContextAdapter)this).ObjectContext;
  38. IObjectSet<TEntity> source = context.CreateObjectSet<TEntity>();
  39. source.Delete(whereExpression);
  40. }
  41. protected override void OnModelCreating(DbModelBuilder modelBuilder)
  42. {
  43. modelBuilder.Conventions.Remove<IncludeMetadataConvention>();
  44. modelBuilder.Configurations.Add(new Log_Operate_Mapping());
  45. modelBuilder.Configurations.Add(new VW_Sys_User_Mapping());
  46. }
  47. public DbSet<Log_Operate> Log_Operate { get; set; }
  48. public DbSet<VW_Sys_User> VW_Sys_User { get; set; }
  49. }
  50. }