예제 #1
0
 public bool CheckForRepositoryChange()
 {
     if (this._query.QueryKind >= QueryLanguage.SQL)
     {
         return(false);
     }
     if (this._lastRepository == this._query.Repository)
     {
         return(false);
     }
     this._lastRepository = this._query.Repository;
     if (this._dcManager != null)
     {
         this._dcManager.Dispose();
     }
     this._dcManager = null;
     this.ResetDCAssembly();
     if (!((this._query.Repository != null) && this._query.Repository.DynamicSchema))
     {
         this.ConfigureLanguage();
         this.ConfigureResolver();
         this._typeResolver.set_CurrentDCNamespace(this._query.QueryBaseClassNamespace);
         this._typeResolver.set_CurrentDCTypeName(this._query.QueryBaseClassName);
         this._typeResolver.set_DataContextBuilding(false);
         this._typeResolver.set_CurrentDCError(null);
         return(true);
     }
     this._typeResolver.set_DataContextBuilding(true);
     this._typeResolver.set_CurrentDCError(null);
     this._dcManager = DataContextManager.SubscribeToDataContextChanges(this._query.Repository, new DataContextCallback(this.DataContextInfoUpdated));
     this._dcManager.GetDataContextInfo(SchemaChangeTestMode.None);
     return(true);
 }
예제 #2
0
 public override void Dispose()
 {
     if (this._dcManager != null)
     {
         this._dcManager.Dispose();
         this._dcManager = null;
     }
     base.Dispose();
 }
예제 #3
0
 public void Dispose()
 {
     if (this._typeResolver != null)
     {
         this._typeResolver.Dispose();
     }
     if (this._dcManager != null)
     {
         this._dcManager.Dispose();
     }
     this._dcManager   = null;
     this._hostControl = null;
 }
예제 #4
0
        public static void GetDataContextInfo(LINQPad.Repository r, DataContextCallback callback, SchemaChangeTestMode schemaTestMode)
        {
            DataContextManager  manager   = new DataContextManager(r, null);
            DataContextCallback callback2 = delegate(DataContextInfo info) {
                manager.Dispose();
                if (callback != null)
                {
                    callback(info);
                }
            };

            if (!((callback != null) || manager.HasOtherSubscribers))
            {
                manager.Dispose();
            }
            else
            {
                manager.GetDataContextInfo(callback2, schemaTestMode);
            }
        }
예제 #5
0
 private void _client_QueryCompleted(object sender, QueryStatusEventArgs e)
 {
     lock (this._executionLock)
     {
         if (sender != this._client)
         {
             return;
         }
         if (e.ExecutionComplete)
         {
             this._queryWatch.Stop();
         }
         this._queryStarting = false;
         if (e.AppDomainRecycleSuggested)
         {
             this.PolluteCachedDomain(false);
         }
     }
     this.OnQueryCompleted(e);
     if (e.DataContextRefreshRequired && this._querySnapshot.Repository.IsEquivalent(base.Repository))
     {
         DataContextManager.RefreshDataContextInfo(base.Repository, SchemaChangeTestMode.TestAndFailNegative);
     }
 }
예제 #6
0
 public bool CheckForRepositoryChange()
 {
     if (this._query.QueryKind >= QueryLanguage.SQL)
     {
         return false;
     }
     if (this._lastRepository == this._query.Repository)
     {
         return false;
     }
     this._lastRepository = this._query.Repository;
     if (this._dcManager != null)
     {
         this._dcManager.Dispose();
     }
     this._dcManager = null;
     this.ResetDCAssembly();
     if (!((this._query.Repository != null) && this._query.Repository.DynamicSchema))
     {
         this.ConfigureLanguage();
         this.ConfigureResolver();
         this._typeResolver.set_CurrentDCNamespace(this._query.QueryBaseClassNamespace);
         this._typeResolver.set_CurrentDCTypeName(this._query.QueryBaseClassName);
         this._typeResolver.set_DataContextBuilding(false);
         this._typeResolver.set_CurrentDCError(null);
         return true;
     }
     this._typeResolver.set_DataContextBuilding(true);
     this._typeResolver.set_CurrentDCError(null);
     this._dcManager = DataContextManager.SubscribeToDataContextChanges(this._query.Repository, new DataContextCallback(this.DataContextInfoUpdated));
     this._dcManager.GetDataContextInfo(SchemaChangeTestMode.None);
     return true;
 }
예제 #7
0
 public void Dispose()
 {
     if (this._typeResolver != null)
     {
         this._typeResolver.Dispose();
     }
     if (this._dcManager != null)
     {
         this._dcManager.Dispose();
     }
     this._dcManager = null;
     this._hostControl = null;
 }
예제 #8
0
            private void GetDCInfo(SchemaChangeTestMode schemaTestMode)
            {
                Exception exception;
                bool      flag = true;

                try
                {
                    object obj2;
                    try
                    {
                        bool flag2;
                        if (this._disposed)
                        {
                            return;
                        }
                        if (!((flag2 = (this._schema == null) || (schemaTestMode == SchemaChangeTestMode.ForceRefresh)) || (schemaTestMode == SchemaChangeTestMode.None)))
                        {
                            bool?nullable = this.HasSchemaChanged();
                            flag2 = nullable.HasValue ? nullable.GetValueOrDefault() : (schemaTestMode == SchemaChangeTestMode.TestAndFailPositive);
                        }
                        if (flag2)
                        {
                            this.UpdateSchema();
                        }
                        else
                        {
                            flag = false;
                        }
                        if (this._lastSchemaChange == new DateTime())
                        {
                            this.HasSchemaChanged();
                        }
                    }
                    catch (Exception exception1)
                    {
                        exception = exception1;
                        if (!(!this._repository.DriverLoader.IsInternalAuthor || IsUserError(exception)))
                        {
                            Program.ProcessException(exception);
                        }
                        else
                        {
                            Log.Write(exception, "Error opening DataContext");
                        }
                        lock ((obj2 = this._locker))
                        {
                            if (this._worker == Thread.CurrentThread)
                            {
                                this._error = (exception is AccessViolationException) ? "An AccessViolationException was thrown when trying to open the connection." : exception.Message;
                                this._repository.IsAutoGenAssemblyAvailable = false;
                                this._repository.AutoGenAssemblyFailed      = true;
                            }
                        }
                    }
                    Delegate[]      invocationList = null;
                    Delegate[]      delegateArray2 = null;
                    DataContextInfo dCInfo         = null;
                    lock ((obj2 = this._locker))
                    {
                        if (this._worker != Thread.CurrentThread)
                        {
                            return;
                        }
                        this._status = "";
                        this._busy   = false;
                        dCInfo       = this.GetDCInfo();
                        if (flag && (this._changeSubscribers != null))
                        {
                            invocationList = this._changeSubscribers.GetInvocationList();
                            foreach (DataContextCallback callback in this._changeSubscribers.GetInvocationList())
                            {
                                if (this._oneOffSubscribers == null)
                                {
                                    break;
                                }
                                this._oneOffSubscribers = (DataContextCallback)Delegate.Remove(this._oneOffSubscribers, callback);
                            }
                        }
                        if (this._oneOffSubscribers != null)
                        {
                            delegateArray2 = this._oneOffSubscribers.GetInvocationList();
                        }
                        this._oneOffSubscribers = null;
                    }
                    if (invocationList != null)
                    {
                        foreach (DataContextCallback callback2 in invocationList)
                        {
                            callback2(dCInfo);
                        }
                    }
                    if (delegateArray2 != null)
                    {
                        foreach (DataContextCallback callback2 in delegateArray2)
                        {
                            callback2(dCInfo);
                        }
                    }
                    if (dCInfo.Error != null)
                    {
                        DataContextManager._globalErrorHandlers(dCInfo);
                    }
                }
                catch (Exception exception2)
                {
                    exception = exception2;
                    Program.ProcessException(exception);
                }
            }
예제 #9
0
 private void InitDCManager(bool forceRefresh)
 {
     this._dcManager = DataContextManager.SubscribeToDataContextChanges(base.Repository, new DataContextCallback(this.DataContextInfoUpdated));
     this._dcManager.GetDataContextInfo(forceRefresh ? SchemaChangeTestMode.ForceRefresh : SchemaChangeTestMode.TestAndFailPositive);
     this._dcManager.Tag = "DynamicSchemaNode";
 }
예제 #10
0
 public override void ReleaseResources()
 {
     base.Nodes.Clear();
     this._dormantNodes = null;
     this._lastSchemaHash = 0;
     if (this._dcManager != null)
     {
         this._dcManager.Dispose();
         this._dcManager = null;
     }
     base.Nodes.Add("(Populating)");
     this._init = false;
     GC.Collect();
 }
예제 #11
0
 public static void GetDataContextInfo(LINQPad.Repository r, DataContextCallback callback, SchemaChangeTestMode schemaTestMode)
 {
     DataContextManager manager = new DataContextManager(r, null);
     DataContextCallback callback2 = delegate (DataContextInfo info) {
         manager.Dispose();
         if (callback != null)
         {
             callback(info);
         }
     };
     if (!((callback != null) || manager.HasOtherSubscribers))
     {
         manager.Dispose();
     }
     else
     {
         manager.GetDataContextInfo(callback2, schemaTestMode);
     }
 }