<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->


<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <?include caerr.wxi ?>

    <!-- Server Custom Action Definitions -->

    <Fragment>
        <UI>
            <Error Id="$(var.msierrSQLFailedCreateDatabase)">!(loc.msierrSQLFailedCreateDatabase)</Error>
            <Error Id="$(var.msierrSQLFailedDropDatabase)">!(loc.msierrSQLFailedDropDatabase)</Error>
            <Error Id="$(var.msierrSQLFailedConnectDatabase)">!(loc.msierrSQLFailedConnectDatabase)</Error>
            <Error Id="$(var.msierrSQLFailedExecString)">!(loc.msierrSQLFailedExecString)</Error>
            <Error Id="$(var.msierrSQLDatabaseAlreadyExists)">!(loc.msierrSQLDatabaseAlreadyExists)</Error>

            <ProgressText Action="InstallSqlData">!(loc.ConfigureSql)</ProgressText>
            <ProgressText Action="UninstallSqlData">!(loc.ConfigureSql)</ProgressText>
            <ProgressText Action="CreateDatabase">!(loc.CreateDatabase)</ProgressText>
            <ProgressText Action="DropDatabase">!(loc.DropDatabase)</ProgressText>
            <ProgressText Action="ExecuteSqlStrings">!(loc.ExecuteSqlStrings)</ProgressText>
            <ProgressText Action="RollbackExecuteSqlStrings">!(loc.RollbackExecuteSqlStrings)</ProgressText>
        </UI>

        <!-- The SQL custom actions should impersonate the user because the user"s cridentials are used when connected to the database if none are provided -->
        <CustomAction Id="InstallSqlData" BinaryKey="ScaSchedule2" DllEntry="InstallSqlData" Execute="immediate" Return="check" />
        <CustomAction Id="UninstallSqlData" BinaryKey="ScaSchedule2" DllEntry="UninstallSqlData" Execute="immediate" Return="check" />
        <CustomAction Id="CreateDatabase" BinaryKey="ScaExecute2" DllEntry="CreateDatabase" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />
        <CustomAction Id="RollbackCreateDatabase" BinaryKey="ScaExecute2" DllEntry="DropDatabase" Execute="rollback" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />
        <CustomAction Id="DropDatabase" BinaryKey="ScaExecute2" DllEntry="DropDatabase" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />
        <CustomAction Id="ExecuteSqlStrings" BinaryKey="ScaExecute2" DllEntry="ExecuteSqlStrings" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />
        <CustomAction Id="RollbackExecuteSqlStrings" BinaryKey="ScaExecute2" DllEntry="ExecuteSqlStrings" Execute="rollback" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />

        <InstallExecuteSequence>
            <Custom Action="UninstallSqlData" Before="RemoveFiles" Overridable="yes">NOT SKIPUNINSTALLSQLDATA AND VersionNT &gt; 400</Custom>
            <Custom Action="InstallSqlData" After="InstallFiles" Overridable="yes">NOT SKIPINSTALLSQLDATA AND VersionNT &gt; 400</Custom>
        </InstallExecuteSequence>
    </Fragment>

    <!-- Server Custom Action DLL Definitions -->
    <Fragment>
        <Binary Id="ScaSchedule2" SourceFile="$(var.scaschedDll)" />
        <Binary Id="ScaExecute2" SourceFile="$(var.scaexecDll)" />
    </Fragment>
</Wix>
