Пример #1
0
        public void Dispose()
        {
            if (this.mainCtx != null)
            {
                this.mainCtx.Dispose();
                this.mainCtx = null;
            }

            if (this.levelsCtx != null)
            {
                this.levelsCtx.Dispose();
                this.levelsCtx = null;
            }
        }
Пример #2
0
        public void Attach(String path, AttachType type)
        {
            if (type == AttachType.Main)
            {
                try
                {
                    this.mainCtx = new MainContext(this.BuildConnection(path));
                    this.ValidateDbSchema(this.mainCtx.Database, this.mainDbSchema);
                }
                catch
                {
                    if (this.mainCtx != null)
                    {
                        this.mainCtx.Dispose();
                        this.mainCtx = null;
                    }

                    throw;
                }
            }
            else if (type == AttachType.Levels)
            {
                try
                {
                    this.levelsCtx = new LevelsContext(this.BuildConnection(path));
                    this.ValidateDbSchema(this.levelsCtx.Database, this.levelDbSchema);
                }
                catch
                {
                    if (this.levelsCtx != null)
                    {
                        this.levelsCtx.Dispose();
                        this.levelsCtx = null;
                    }

                    throw;
                }
            }
        }