Share via


DefaultValue Class

Represents a default value for a part of an input parameter of a back-end method.

Inheritance Hierarchy

System.Object
  Microsoft.Office.Server.ApplicationRegistry.MetadataModel.DefaultValue

Namespace:  Microsoft.Office.Server.ApplicationRegistry.MetadataModel
Assembly:  Microsoft.SharePoint.Portal (in Microsoft.SharePoint.Portal.dll)

Syntax

'Declaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Class DefaultValue
'Usage
Dim instance As DefaultValue
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class DefaultValue

Remarks

Some methods have complex signatures. For example, the Web service to get SAP customers could take six parameters, three of which could be structures with subparameters. To make it easier for users to call these methods, the Business Data Catalog allows you to specify default values for the parameters in the metadata. In this way, users can invoke predefined business logic without having to undertake parameter construction.

The user can override any input parameter for which you have defined a DefaultValue object. The user must specify any input parameter that has no DefaultValue object, if the parameter is not optional.

For each abstract primitive in a TypeDescriptor object, you can define multiple default values, each of which corresponds to a particular MethodInstance object. At run time, depending on which MethodInstance object the client executes, a parameter will be instantiated based on the corresponding default values.

If all parts of a parameter have default values, the Business Data Catalog can create an instance of the parameters for a method and execute it.

There is a different default value for each MethodInstance for a Method. Thus, executing different MethodInstances can result in completely different parameter instances being created by the Business Data Catalog.

The absence of a DefaultValue for a TypeDescriptor causes the value for that Type when instantiated to be considered as 'null'. Default Values should never be Nullable<> types. In most cases, they should be primitive types, from which the Business Data Catalog will construct complex instances.

Schema

Child

Type

Occurs

Default

Limits / Accepted Values

Description

#text

Text

1..1

Min. length: 1

The default value.

If the type is a DateTime, the value is a string in the DateTimeFormatInfo.UniversalSortableDateTimePattern format.

If the type is a derived class of Enum, the value is the string representation of the enumeration value.

If the type is a GUID, the value is of the format “XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX”

If the type is a type a "primitive" (Int16, Int32, Int64, Single, Double, Decimal, Boolean, String, Byte, and so on), the value is a string representation of the type (We use XmlReader.ReadElementContentAsString()).

If the type is any other serializable type, the value is a binary-formatted, base64-encoded string.

MethodInstanceName

Attribute (String)

1..1

The name of the MethodInstance object to which this DefaultValue object applies.

Type

Attribute (System.String)

1..1

System.Int16

System.Int32

System.Int64

System.Single

System.Double

System.Decimal

System.Boolean

System.String

System.Byte

System.UInt16

System.UInt32

System.UInt64

System.Guid

System.String

System.DateTime

Any other serializable type (such as where Type.IsSerializable == true)

The type of the default value.

Thread Safety

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

See Also

Reference

DefaultValue Members

Microsoft.Office.Server.ApplicationRegistry.MetadataModel Namespace