IEntity.CreateWithFields Method (IFieldValueDictionary, Identity, ILobSystemInstance)
Creates an external item with an assigned identity, 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 _
) As EntityInstanceReference
'Usage
Dim instance As IEntity
Dim fieldValues As IFieldValueDictionary
Dim assignedIdentity As Identity
Dim lsi As ILobSystemInstance
Dim returnValue As EntityInstanceReference
returnValue = instance.CreateWithFields(fieldValues, _
assignedIdentity, lsi)
EntityInstanceReference CreateWithFields(
IFieldValueDictionary fieldValues,
Identity assignedIdentity,
ILobSystemInstance lsi
)
Parameters
fieldValues
Type: Microsoft.BusinessData.Runtime.IFieldValueDictionaryThe parameters of the Create method.
assignedIdentity
Type: Microsoft.BusinessData.Runtime.IdentityThe identity that is assigned to the instance.
lsi
Type: Microsoft.BusinessData.MetadataModel.ILobSystemInstanceThe external system instance.
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.