Share via


IEntity.CreateWithFields Method (IFieldValueDictionary, ILobSystemInstance)

Creates an external item, 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, _
    lsi As ILobSystemInstance _
) As EntityInstanceReference
'Usage
Dim instance As IEntity
Dim fieldValues As IFieldValueDictionary
Dim lsi As ILobSystemInstance
Dim returnValue As EntityInstanceReference

returnValue = instance.CreateWithFields(fieldValues, _
    lsi)
EntityInstanceReference CreateWithFields(
    IFieldValueDictionary fieldValues,
    ILobSystemInstance lsi
)

Parameters

Return Value

Type: Microsoft.BusinessData.Runtime.EntityInstanceReference
A reference to the newly created 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, ILobSystemInstance)