public UIData(int uiID, string path, LoadStrategy loadMode) { m_UIID = uiID; //m_PanelClassType = type; m_ResPath = path; m_LoadStrategy = loadMode; }
public virtual async Task <Tuple <IEnumerable <TEntity>, int> > GetAll ( int skip, int take, LoadStrategy loadStrategy = LoadStrategy.AsNoTracking ) { var databaseCount = await DbSet .CountAsync() .ConfigureAwait(false); if (loadStrategy == LoadStrategy.AsNoTracking) { return(new Tuple <IEnumerable <TEntity>, int> ( await DbSet.AsNoTracking() .Skip(skip) .Take(take) .ToListAsync() .ConfigureAwait(false), databaseCount )); } return(new Tuple <IEnumerable <TEntity>, int> ( await DbSet .Skip(skip) .Take(take) .ToListAsync() .ConfigureAwait(false), databaseCount )); }
/// <summary> /// Loads user strategy and extracts constructor parameters /// </summary> private void LoadUserStrategy(LoadStrategy loadStrategy) { try { if (_asyncClassLogger.IsInfoEnabled) { _asyncClassLogger.Info("Trying to load user defined strategy from: " + loadStrategy.StrategyAssembly.FullName.Substring(0, loadStrategy.StrategyAssembly.FullName.IndexOf(",", System.StringComparison.Ordinal)), _type.FullName, "LoadUserStrategy"); } var strategyDetails = LoadCustomStrategy.GetConstructorDetails(loadStrategy.StrategyAssembly); if (strategyDetails != null) { if (_asyncClassLogger.IsInfoEnabled) { _asyncClassLogger.Info("Successfully loaded custom strategy: " + strategyDetails.Item1.Name, _type.Name, "LoadUserStrategy"); } // Create new Strategy Constructor Info object StrategyConstructorInfo strategyConstructorInfo = new StrategyConstructorInfo( strategyDetails.Item2, strategyDetails.Item1); // Publish Event to Notify Listener. EventSystem.Publish <StrategyConstructorInfo>(strategyConstructorInfo); } } catch (Exception exception) { _asyncClassLogger.Error(exception, _type.FullName, "LoadUserStrategy"); } }
/// <summary> /// Loads the selected Strategy Type /// </summary> private void LoadStrategy() { try { IUnityContainer container = new UnityContainer(); // Open File Dialog Service to browse file var fileDialogService = container.Resolve <FileDialogService>(); if (fileDialogService.OpenFileDialog(".dll", "Library Files") == true) { if (Logger.IsDebugEnabled) { Logger.Debug("File select browser opened.", _type.FullName, "LoadStrategy"); } // Get the name of the selected file string fileName = fileDialogService.FileName; // Load Assembly file from the selected file Assembly assembly = Assembly.LoadFrom(fileName); if (assembly != null) { // Save File name FileName = assembly.FullName.Substring(0, assembly.FullName.IndexOf(",", System.StringComparison.Ordinal)); // Save Assembly reference _strategyAssembly = assembly; if (Logger.IsInfoEnabled) { Logger.Info("Successfully loaded User Strategy: " + assembly.FullName, _type.FullName, "LoadStrategy"); } // Clear previously saved parameters _selectedConstuctorParameters.Clear(); // Reset Count _parametersCount = 0; // Create new Strategy Runner LoadStrategy Object LoadStrategy loadStrategy = new LoadStrategy(_strategyAssembly); // Publish Event to notify Listeners. EventSystem.Publish <LoadStrategy>(loadStrategy); return; } if (Logger.IsInfoEnabled) { Logger.Info("Unable to load User Strategy", _type.FullName, "LoadStrategy"); } } } catch (Exception exception) { Logger.Error(exception, _type.FullName, "LoadStrategy"); } }
public UIData(int uiID, string path, bool singleton, int cacheCount, LoadStrategy loadMode) { m_UIID = uiID; //m_PanelClassType = type; m_ResPath = path; m_IsSingleton = singleton; m_CacheCount = cacheCount; m_LoadStrategy = loadMode; }
public virtual async Task <TEntity> GetByIdAsync(int entityId, LoadStrategy loadStrategy = LoadStrategy.AsNoTracking) { return(loadStrategy == LoadStrategy.AsNoTracking ? await DbSet .AsNoTracking() .SingleOrDefaultAsync(entity => entity.Id == entityId) .ConfigureAwait(false) : await DbSet.FindAsync(entityId).ConfigureAwait(false)); }
public static void Load() { if (Loaded) { return; } Loaded = true; log.Info("Loading started"); var start = DateTime.UtcNow; Loading = true; m_AddQueue = new Queue <IEntity>(); m_DeleteQueue = new Queue <IEntity>(); var strategy = LoadStrategy.Acquire(); strategy.LoadEntities(m_Repositories); EventSink.InvokeWorldLoad(); Loading = false; ProcessSafetyQueues(); foreach (var item in m_Items.Values) { if (item.Parent == null) { item.UpdateTotals(); } item.ClearProperties(); } foreach (var m in m_Mobiles.Values) { m.UpdateRegion(); // Is this really needed? m.UpdateTotals(); m.ClearProperties(); } if (ManualGC) { GC.Collect(); } log.Info("Loading done: {1} items, {2} mobiles ({0:F1} seconds)", (DateTime.UtcNow - start).TotalSeconds, m_Items.Count, m_Mobiles.Count); }
public void Load() { if (m_Loaded) { return; } m_Loaded = true; Console.Write("World: Loading..."); DateTime start = DateTime.Now; m_Loading = true; m_AddQueue = new Queue <IEntity>(); m_DeleteQueue = new Queue <IEntity>(); LoadStrategy strategy = LoadStrategy.Acquire(); strategy.LoadEntities(m_Repositories); EventSink.Instance.InvokeWorldLoad(); m_Loading = false; ProcessSafetyQueues(); foreach (Item item in m_Items.Values) { if (item.Parent == null) { item.UpdateTotals(); } item.ClearProperties(); } foreach (Mobile m in m_Mobiles.Values) { m.UpdateRegion(); // Is this really needed? m.UpdateTotals(); m.ClearProperties(); } if (ManualGC) { System.GC.Collect(); } Console.WriteLine(String.Format("done: {1} items, {2} mobiles ({0:F1} seconds)", (DateTime.Now - start).TotalSeconds, m_Items.Count, m_Mobiles.Count)); }
public virtual async Task <Tuple <IEnumerable <TEntity>, int> > GetAll ( int skip, int take, Expression <Func <TEntity, bool> > where, Expression <Func <TEntity, object> > orderBy, LoadStrategy loadStrategy = LoadStrategy.AsNoTracking ) { var databaseCount = await DbSet .CountAsync() .ConfigureAwait(false); if (loadStrategy == LoadStrategy.AsNoTracking) { return(new Tuple <IEnumerable <TEntity>, int> ( await DbSet .AsNoTracking() .OrderBy(orderBy) .Where(where) .Skip(skip) .Take(take) .ToListAsync() .ConfigureAwait(false), databaseCount )); } return(new Tuple <IEnumerable <TEntity>, int> ( await DbSet .OrderBy(orderBy) .Where(where) .Skip(skip) .Take(take) .ToListAsync() .ConfigureAwait(false), databaseCount )); }
public PanelData(int uiID, string path, bool singleton, int cacheCount, LoadStrategy loadMode) : base(uiID, path, singleton, cacheCount, loadMode) { }
public PanelData(int uiID, string path, LoadStrategy loadMode) : base(uiID, path, loadMode) { }
public HasOneAttribute(string rltnName, LoadStrategy strategy) { }
public HasOneAttribute(LoadStrategy strategy) { }
public static void SetLoadMode(LoadStrategy loadMode) { m_LoadStrategy = loadMode; }
/// <summary> /// Reads new data file. /// </summary> /// <param name="filePath">Path to file.</param> /// <returns>IEnumerable of read data.</returns> private protected override IEnumerable <Computer> ReadNewDataFile(string filePath) { return(LoadStrategy.ReadData(filePath)); }
public HasManyAttribute(LoadStrategy strategy) { }