예제 #1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="OptimizeContext" /> class.
        /// </summary>
        /// <remarks>
        ///     <para>The arguments supported by <paramref name="args" /> are:</para>
        ///     <para><c>outputDir</c>--The directory to put files in. Paths are relative to the project directory.</para>
        ///     <para><c>modelNamespace</c>--Specify to override the namespace of the generated model.</para>
        ///     <para><c>contextType</c>--The <see cref="DbContext" /> to use.</para>
        /// </remarks>
        /// <param name="executor">The operation executor.</param>
        /// <param name="resultHandler">The <see cref="IOperationResultHandler" />.</param>
        /// <param name="args">The operation arguments.</param>
        public OptimizeContext(
            OperationExecutor executor,
            IOperationResultHandler resultHandler,
            IDictionary args)
            : base(resultHandler)
        {
            Check.NotNull(executor, nameof(executor));
            Check.NotNull(args, nameof(args));

            var outputDir      = (string?)args["outputDir"];
            var modelNamespace = (string?)args["modelNamespace"];
            var contextType    = (string?)args["contextType"];

            Execute(() => executor.OptimizeContextImpl(outputDir, modelNamespace, contextType));
        }