コード例 #1
0
ファイル: ZentityBase.cs プロジェクト: Plankankul/Zenity
        /// <summary>
        /// Creates instance of <see cref="ZentityContext"/> class with specified connection string if provided otherwise
        /// with default connection string.
        /// </summary>
        /// <returns>Instance of <see cref="ZentityContext"/>.</returns>
        public ZentityContext CreateContext()
        {
            ZentityContext context = null;

            // if connection string is empty then creates default context
            if (string.IsNullOrEmpty(this.ConnectionString))
            {
                context = new ZentityContext();
            }
            else
            {
                context = new ZentityContext(this.ConnectionString);
            }
            context.CommandTimeout = this.GetConnectionTimeoutInterval();

            CoreHelper.LoadMetadata(context);

            return(context);
        }