SqlMethodAttribute.IsMutator Property

Definition

Indicates whether a method on a user-defined type (UDT) is a mutator.

C#
public bool IsMutator { get; set; }

Property Value

true if the method is a mutator; otherwise false.

Remarks

If the IsMutator property is set to true and the return type of the method is void, SQL Server marks the method as a mutator. A mutator method is one that causes a state change in the UDT instance. Mutator methods can be called in assignment statements or data modification statements, but cannot be used in queries. If a method is marked as a mutator but does not return void, then CREATE TYPE does not fail with an error. Even though a returned value other than void does not raise an error, the returned value is not accessible and cannot be used.

The default value of the IsMutator property is false.

A property can be a mutator if SqlMethodAttribute is used on the setter and IsMutator is set to true. However, a property setter is implicitly treated as a mutator, so it is not necessary to set the IsMutator property of the SqlMethodAttribute to true.

Applies to

Product Versions
SqlClient .NET Core 1.0, 1.1, 2.0, 2.1, 3.0, 3.1, 4.0, 4.1
SqlClient .NET Framework 1.0, 1.1, 2.0, 2.1, 3.0, 3.1, 4.0, 4.1
SqlClient .NET Standard 1.0, 1.1, 2.0, 2.1, 3.0, 3.1, 4.0, 4.1