Esempio n. 1
0
 public UnitOfWork(CodeCamperDbContext context)
 {
     Debug.WriteLine("new UnitOfWork()");
     Context        = context;
     ServiceLocator = Microsoft.Practices.ServiceLocation.ServiceLocator.Current;
     SetupDbContext();
 }
Esempio n. 2
0
        protected void CreateDbContext()
        {
            DbContext = new CodeCamperDbContext();

            // Do not enable proxied entities
            DbContext.Configuration.ProxyCreationEnabled = false;

            DbContext.Configuration.LazyLoadingEnabled = false;

            DbContext.Configuration.ValidateOnSaveEnabled = false;
        }
Esempio n. 3
0
        protected void CreateDbContext()
        {
            DbContext = new CodeCamperDbContext();

            // Do NOT enable proxied entities, else serialization fails
            DbContext.Configuration.ProxyCreationEnabled = false;

            // Load navigation properties explicitly (avoid serialization trouble)
            DbContext.Configuration.LazyLoadingEnabled = false;

            // Because Web API will perform validation, we don't need/want EF to do so
            DbContext.Configuration.ValidateOnSaveEnabled = false;

            //DbContext.Configuration.AutoDetectChangesEnabled = false;
            // We won't use this performance tweak because we don't need
            // the extra performance and, when autodetect is false,
            // we'd have to be careful. We're not being that careful.
        }