Пример #1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="AddMigration" /> class.
        /// </summary>
        /// <remarks>
        ///     <para>The arguments supported by <paramref name="args" /> are:</para>
        ///     <para><c>name</c>--The name of the migration.</para>
        ///     <para>
        ///         <c>outputDir</c>--The directory (and sub-namespace) to use. Paths are relative to the project directory. Defaults to
        ///         "Migrations".
        ///     </para>
        ///     <para><c>contextType</c>--The <see cref="DbContext" /> type 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 AddMigration(
            OperationExecutor executor,
            IOperationResultHandler resultHandler,
            IDictionary args)
            : base(resultHandler)
        {
            Check.NotNull(executor, nameof(executor));
            Check.NotNull(args, nameof(args));

            var name        = (string)args["name"] !;
            var outputDir   = (string?)args["outputDir"];
            var contextType = (string?)args["contextType"];
            var @namespace  = (string?)args["namespace"];

            Execute(() => executor.AddMigrationImpl(name, outputDir, contextType, @namespace));
        }