示例#1
0
        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;
        }
示例#2
0
 /// <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);
 }
示例#4
0
 /// <exclude />
 public void AddDefaultService(object service)
 {
     DataServiceScopeManager.AddDefaultService(service);
 }
示例#5
0
        internal void EnableServices()
        {
            DataServiceScopeManager.EnableServices();

            _servicesDisabled = false;
        }
示例#6
0
        internal void DisableServices()
        {
            DataServiceScopeManager.DisableServices();

            _servicesDisabled = true;
        }