We recommend using Visual Studio 2017

DacCompilationUnit Class

The DacCompilationUnit accepts Transact-SQL content and compiles it into a data-tier application (DAC) type. Any Transact-SQL file can be added or removed prior to compilation. 


Namespace:  Microsoft.SqlServer.Management.Dac
Assembly:  Microsoft.SqlServer.Management.Dac (in Microsoft.SqlServer.Management.Dac.dll)

public class DacCompilationUnit

The DacCompilationUnit type exposes the following members.

Public methodDacCompilationUnit()Initializes a new instance of the DacCompilationUnit class.
Public methodDacCompilationUnit(String, Version, String)Initializes a new instance of the DacCompilationUnit class with the specified information.

Public propertyDatabaseCollationGets or sets the database collation used for the compile.
Public propertyDescriptionGets or sets the text description of the DAC type.
Public propertyMiscellaneousFilesA collection enumerating the miscellaneous files to include in the DAC type.
Public propertyTargetSelectionPolicyGets or sets the server selection policy to compile into the DAC type.
Public propertyTypeNameGets or sets the name of the DAC type.
Public propertyVersionGets or sets the version of the DAC type.

Public methodAddTSqlSourceFileAdds a Transact-SQL script file to the compilation unit.
Public methodCompileCompiles a DAC type based on the Transact-SQL scripts, server selection policy, and miscellaneous files specified for the DacCompilationUnit object.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodRemoveTSqlSourceFileRemoves a Transact-SQL script file from the compilation unit.
Public methodToString (Inherited from Object.)

Using the DacCompilationUnit object, you can:

  • Add and remove Transact-SQL command files.

  • Compile the DAC type with a given collation.

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.