Condividi tramite


IEntity.CreateWithFields Method (IFieldValueDictionary, Identity, ILobSystemInstance, OperationMode)

Creates an external item with an assigned identity and a specific OperationMode object, and sets all fields of the external content type to the given values with an update.

Namespace:  Microsoft.BusinessData.MetadataModel
Assembly:  Microsoft.BusinessData (in Microsoft.BusinessData.dll)

Syntax

'Declaration
Function CreateWithFields ( _
    fieldValues As IFieldValueDictionary, _
    assignedIdentity As Identity, _
    lsi As ILobSystemInstance, _
    mode As OperationMode _
) As EntityInstanceReference
'Usage
Dim instance As IEntity
Dim fieldValues As IFieldValueDictionary
Dim assignedIdentity As Identity
Dim lsi As ILobSystemInstance
Dim mode As OperationMode
Dim returnValue As EntityInstanceReference

returnValue = instance.CreateWithFields(fieldValues, _
    assignedIdentity, lsi, mode)
EntityInstanceReference CreateWithFields(
    IFieldValueDictionary fieldValues,
    Identity assignedIdentity,
    ILobSystemInstance lsi,
    OperationMode mode
)

Parameters

Return Value

Type: Microsoft.BusinessData.Runtime.EntityInstanceReference
A reference to the new instance.

Remarks

You can use this method to create an external item by specifying the values of fields of the created external item. If the Create MethodInstance accepts all the fields that are provided, BDC will just invoke the Create MethodInstance. Otherwise, BDC will also invoke the Update MethodInstance on the created external item to set the specified values for the remaining fields. If the Create operation is successful, and the consequent update operation fails, this operation will throw a PartialCreateException, which will contain the Identity of the created instance.

The method returns the EntityInstanceReference to the external item that was created. The IFieldValueDictionary instance provided as an input to this method should be created from a View that corresponds to a MethodInstance of type SpecificFinder, obtained via the GetCreatorView(String) method.

The mode of operation can be specified for this method. For more information about how to use operation modes, see OperationMode.

Instances of objects in the Business Data Connectivity object model are tied to the Metadata Store they are obtained from. Using instances tied to one Metadata Store with the instances from another Metadata Store will cause data corruption and other unexpected behavior. For more information, see DatabaseBackedMetadataCatalog, FileBackedMetadataCatalog, and RemoteSharedFileBackedMetadataCatalog.

See Also

Reference

IEntity Interface

IEntity Members

CreateWithFields Overload

Microsoft.BusinessData.MetadataModel Namespace

Create(IFieldValueDictionary, Identity, ILobSystemInstance)