[POSSIBLE BUG] FeatureTable.CanAdd() lacks Feature argument

11-24-2016 02:09 AM
New Contributor II

FeatureTable.CanAdd() lacks Feature argument - is this intentionally?

Note that FeatureTable.CanUpdate(feature) and FeatureTable.CanDelete(feature) have Feature argument. Note also that in Beta FeatureTable.CanAdd(feature) also had Feature argument.


0 Kudos
2 Replies
Esri Frequent Contributor


Thanks for the question. When reviewing the design post-beta, we decided CanAdd(feature) was unnecessary. It was essentially a convenience method which checks the service capabilities which are either true or false, regardless of the feature. Therefore the workflow is:

- Check FeatureTable.IsEditable

- Check FeatureTable.CanAdd()

- Create new Feature

- Call FeatureTable.AddFeatureAsync

- Handle the exception (if any)



0 Kudos
New Contributor II

Hi Mike,

Thanks for reply. But there is something unclear to me.

I agree that CanUpdate(feature) and CanDelete(feature) both should check specific cases, inapplicable to CanAdd() (for example - to be updated/deleted, a feature must already exists, which is not the case with adding new feature). But there are also checks applicable to both CanAdd() and CanUpdate(feature) equally:

- a feature with text field should be checked whether text value fits in field size;

- a feature should be checked for invalid values in an attribute (e.g. null value in NOT NULL field);

- a feature with unique field constraint should be checked whether constraint will not be violated by a feature field value;

- a feature should be checked whether it contains additional fields (added by code) not present in the FeatureTable

With these checks in mind in beta I realize following workflow (for update, but also for add):

- Check FeatureTable.IsEditable

- Create new Feature/Obtain Feature to edit

- Edit feature attributes/geometry

- Check FeatureTable.CanAdd(feature)/FeatureTable.CanUpdate(feature)

- Call FeatureTable.AddFeaturesAsync/FeatureTable.UpdateFeaturesAsync

- Handle the exception (if any)

Obviously now these checks cannot be performed prior to adding feature and catching exception - is this correct?. I am also curious - are these checks performed at CanUpdate(feature)?

Best Regards,

Plamen Ivanov

ESRI Bulgaria

0 Kudos