/// <summary>Performs the shutdown of the application. Notifies all components and modules about pending application shutdown. /// </summary> public virtual void Shutdown() { ActivationLog.WriteMessage("Shutting down app {0}. =======================\r\n\r\n", AppName); Flush(); if (_shutdownTokenSource != null) { _shutdownTokenSource.Cancel(); Task.Yield(); } Status = EntityAppStatus.Shutdown; foreach (var module in this.Modules) { module.Shutdown(); } //shutdown services var servList = this.GetAllServices(); for (int i = 0; i < servList.Count; i++) { var service = servList[i]; var iEntService = service as IEntityServiceBase; if (iEntService != null) { iEntService.Shutdown(); } } if (this.LogFileWriter != null) { } AppEvents.OnShutdown(); }
public void BuildModel() { Log.WriteMessage(" Building entity model...", _app.AppName); _customization.Closed = true; CollectEntitiesAndViews(); //Model customization ProcessReplacedEntities(); BuildEntityMembers(); ProcessAddedMembers(); ProcessAddedIndexes(); if (Log.ErrorCount > 0) { return; } VerifyPrimaryKeys(); Model.ModelState = EntityModelState.Draft; _app.AppEvents.OnModelConstructing(this); CollectInitializeAttributes(); ApplyAttributesProcessRefsLists(); ExpandEntityKeyMembers(); SetKeyNames(); Model.ModelState = EntityModelState.Constructed; _app.AppEvents.OnModelConstructing(this); ValidateKeys(); CompleteEntitiesSetup(); BuildDefaultInitialValues(); BuildEntityClasses(); ComputeTopologicalIndexes(); CollectEnumTypes(); if (Log.ErrorCount > 0) { return; } Model.ModelState = EntityModelState.Completed; _app.AppEvents.OnModelConstructing(this); //fire event _app.AppEvents.OnInitializing(EntityAppInitStep.Initialized); Log.WriteMessage("Entity model built successfully."); }//method