Partager via


ModelLoadOptions.ThrowOnModelErrors Property

Definition

Defines whether the model edit APIs throw a DacModelException if there are any blocking errors present in the model.

When adding a new object or deleting/modifying existing objects in the model using API calls such as AddObjects(String), AddOrUpdateObjects(String, String, TSqlObjectOptions), DeleteObjects(String) and ConvertToScriptedObject(TSqlObject, String), the model throws DacModelException signaling the presence of model blocking errors. Model blocking errors indicates the presence of serious errors such as parser, interpreter and other errors in the objects. Setting this option to false allows building the model even if it has such serious errors. Subsequently those objects with model errors can be retrieved using the GetModelErrors() method.

When objects with model blocking errors are added to the model, the object is edited such that errant parts are removed or commented out in a best effort manner to preserve the parts of the object that do not have errors. For instance a stored procedure that has a parser error in the procedure body will have its body commented out before adding to the model. As a worst case the object is completely dropped while preserving the model errors.

Note that current implementation handles objects with model errors as follows

  1. Sql procedures and views are added to the model with commented body.
  2. Other object types are completely dropped while preserving the model errors.
public bool ThrowOnModelErrors { get; set; }
member this.ThrowOnModelErrors : bool with get, set
Public Property ThrowOnModelErrors As Boolean

Property Value

Applies to