コード例 #1
0
        /// <summary>
        /// Initializes the data context and creates the EF DbContext instance.
        /// </summary>
        public override void InitializeDataContext(AppContextBase appContext)
        {
            this.AppContext = appContext;

            bool?enableLazyLoading   = this.AppContext.Options.ContainsKey("EF_EnableLazyLoading") ? (bool?)this.AppContext.Options["EF_EnableLazyLoading"] : null;
            bool?enableProxyCreation = this.AppContext.Options.ContainsKey("EF_EnableProxyCreation") ? (bool?)this.AppContext.Options["EF_EnableProxyCreation"] : null;
            IEntityDataValidator <EntityDataContext <TDbContext>, TDbContext> validator = this.AppContext.Options.ContainsKey("EF_EntityAppValidator") ? (IEntityDataValidator <EntityDataContext <TDbContext>, TDbContext>) this.AppContext.Options["EF_EntityAppValidator"] : DefaultValidator;

            this.Data = new TDbContext();

            //TODO: not supported in EF Core
            //if (enableLazyLoading.HasValue)
            //    this.Data.Configuration.LazyLoadingEnabled = enableLazyLoading.Value;
            //if (enableProxyCreation.HasValue)
            //    this.Data.Configuration.ProxyCreationEnabled = enableProxyCreation.Value;

            _validator = validator;

            IAppContextAware appContextAwareDataContext = this.Data as IAppContextAware;

            if (appContextAwareDataContext != null)
            {
                appContextAwareDataContext.InitializeFromAppContext(appContext);
            }
        }
 private DataLoader(IEntityDataValidator validator)
 {
     _validator = validator;
 }
コード例 #3
0
 public static IDataLoader CreateIt(IEntityDataValidator validator)
 {
     return new DataLoader(validator);
 }
 public static IDataLoader CreateIt(IEntityDataValidator validator)
 {
     return(new DataLoader(validator));
 }
コード例 #5
0
 private DataLoader(IEntityDataValidator validator)
 {
     _validator = validator;
 }