void Dispose(bool disposing) { if (!disposing) { return; } if (_disposed) { throw new ObjectDisposedException(nameof(DataScope)); } if (_servicesDisabled) { EnableServices(); } if (_dataScopePushed) { DataScopeManager.PopDataScope(); } if (_cultureInfoPushed) { LocalizationScopeManager.PopLocalizationScope(); } if (_dataServicePushed) { DataServiceScopeManager.PopDataServiceScope(); } _disposed = true; }
/// <exclude /> public void AddService(object service) { if (!_dataServicePushed) { DataServiceScopeManager.PushDataServiceScope(); _dataServicePushed = true; } DataServiceScopeManager.AddService(service); }
/// <summary> /// Adds a default service to data scope manager. All DataScopes created after this point will include the service you provide. /// </summary> /// <param name="service"></param> public static void RegisterDefaultService(object service) { DataServiceScopeManager.AddDefaultService(service); }
/// <exclude /> public void AddDefaultService(object service) { DataServiceScopeManager.AddDefaultService(service); }
internal void EnableServices() { DataServiceScopeManager.EnableServices(); _servicesDisabled = false; }
internal void DisableServices() { DataServiceScopeManager.DisableServices(); _servicesDisabled = true; }