ComponentOne ADO.NET DataExtender
C1.C1DataExtender.2 Assembly / C1.C1DataExtender Namespace / C1DataViewSet Class / AutoFetchParentsForOrphans Property

In This Topic
    AutoFetchParentsForOrphans Property (C1DataViewSet)
    In This Topic
    Indicates whether automatic fetching of an absent on a client parent row for an existing child row is permitted in order to prevent foreign key constraint violation in the underlying DataSet.
    Syntax
    'Declaration
     
    Public Property AutoFetchParentsForOrphans As AutoFetchParentsModeEnum
    public AutoFetchParentsModeEnum AutoFetchParentsForOrphans {get; set;}
    Remarks
    Since C1DataView performs server side filtering when its definition statement contains the WHERE clause, there is a chance that some rows of a child DataTable in a C1DataViewSet's underlying DataSet have no corresponding rows in a parent DataTable. Not because this is actually the case, but due to specific filter conditions defined in WHERE clauses of views' definition statements. This situation causes a foreign key constraint violation on a client, which is logically wrong because a corresponding parent row really exists on a server. To bypass this issue, C1DataViewSet automatically detects orphan child rows and makes an attempt to fetch a correspondig parent row from a server. Note that those "redundant" rows fetched from server to a parent DataTable for the sake of preventing a foreign key constraint violation will not affect rowsets of C1DataViews based on this table because a filter condition specified in the WHERE clause of such C1DataView is evaluated on a client as well. You can turn this behaviour on or off for C1DataViewSet using its AutoFetchParentsForOrphans property, by setting it to AutoFetchParentsModeEnum.Yes to turn on auto fetching and to AutoFetchParentsModeEnum.No to turn it off. If this property is assigned to AutoFetchParentsModeEnum.Default value (which is the default) then permission to fetch rows in a certain DataTable (to satisfy orphan rows in its child tables) is determined by settings in DataSet Extender that are referenced by C1DataViewSet in the SchemaExtender property. Each table (C1.C1DataExtender.SchemaExtender.DataTableExtender class) in DataSet Extender has the C1.C1DataExtender.SchemaExtender.DataTableExtender.AutoFetchParentsForOrphans property that enables (true) or disables (false) auto fetching rows for this table. If C1DataViewSet doesn't reference any DataSet Extender then AutoFetchParentsModeEnum.Default value of the AutoFetchParentsForOrphans property is treated as being set to Yes.
    See Also