IEntity.CreateWithFields Method (IFieldValueDictionary, AssociationEntityInstancesDictionary, ILobSystemInstance, OperationMode)
Creates an external item, with a specific OperationMode object, associated with other external items, 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, _
associatedInstances As AssociationEntityInstancesDictionary, _
lsi As ILobSystemInstance, _
mode As OperationMode _
) As EntityInstanceReference
'Usage
Dim instance As IEntity
Dim fieldValues As IFieldValueDictionary
Dim associatedInstances As AssociationEntityInstancesDictionary
Dim lsi As ILobSystemInstance
Dim mode As OperationMode
Dim returnValue As EntityInstanceReference
returnValue = instance.CreateWithFields(fieldValues, _
associatedInstances, lsi, mode)
EntityInstanceReference CreateWithFields(
IFieldValueDictionary fieldValues,
AssociationEntityInstancesDictionary associatedInstances,
ILobSystemInstance lsi,
OperationMode mode
)
Parameters
fieldValues
Type: Microsoft.BusinessData.Runtime.IFieldValueDictionaryThe parameters of the Create method.
associatedInstances
Type: Microsoft.BusinessData.Runtime.AssociationEntityInstancesDictionaryThe external content type instances that are associated with this instance during creation.
lsi
Type: Microsoft.BusinessData.MetadataModel.ILobSystemInstanceThe external system instance.
mode
Type: Microsoft.BusinessData.Runtime.OperationModeThe mode in which to create the external item.
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
Microsoft.BusinessData.MetadataModel Namespace
Create(IFieldValueDictionary, AssociationEntityInstancesDictionary, ILobSystemInstance)