1e41f4b71Sopenharmony_ci# Accessing a DataShareExtensionAbility from the FA Model
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci## Overview
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ciRegardless of the FA model or stage model, the data read/write function consists of the client and server.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci- In the FA model, the client uses the **DataAbilityHelper** class to provide external APIs, and the server uses the **DataAbility** class to provide database read and write services.
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci- In the stage model, the client uses the **DataShareHelper** class to provide external APIs, and the server uses the **DataShareExtensionAbility** class to provide database read and write services.
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ciIf the client uses the FA model whereas the server is upgraded to the stage model, the client cannot access the server.
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ciTo resolve this issue, the system provides a solution on the framework side for smooth evolution.
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci## Basic Principles
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ciA compatible method is that **DataAbilityHelper** determines whether to call the **DataShareHelper** APIs based on the URI prefix (either **DataAbility** or **DataShare**). However, this method requires modification to the URI in the original client code.
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ciInstead of manual modification, the system adopts the following processing:
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci1. The system attempts to start the DataAbility based on the URI passed in. If the startup fails, the system converts the URI prefix to **DataShare** and attempts to start the DataShareExtensionAbility.
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci2. If the URI does not map to any DataAbility or DataShareExtensionAbility, the startup fails. Otherwise, either the DataAbility or DataShareExtensionAbility is started.
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci## Constraints
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci1. When you switch a DataAbility to a DataShareExtensionAbility, only the URI prefix can be modified.
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci   ![FAvsStage-uri](figures/FAvsStage-uri.png)
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci3. The **DataShareHelper** class implements only certain APIs of **DataAbilityHelper**. For details about the APIs, see the table below.
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci   **Table 1** API compatibility when the FA model accesses a DataShareExtensionAbility of the stage model
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci   | API| Provided by DataAbilityHelper| Provided by DataShareHelper| Compatible|
39e41f4b71Sopenharmony_ci   | -------- | -------- | -------- | -------- |
40e41f4b71Sopenharmony_ci   | on | Yes| Yes| Yes|
41e41f4b71Sopenharmony_ci   | off | Yes| Yes| Yes|
42e41f4b71Sopenharmony_ci   | notifyChange | Yes| Yes| Yes|
43e41f4b71Sopenharmony_ci   | insert | Yes| Yes| Yes|
44e41f4b71Sopenharmony_ci   | delete | Yes| Yes| Yes|
45e41f4b71Sopenharmony_ci   | query | Yes| Yes| Yes|
46e41f4b71Sopenharmony_ci   | update | Yes| Yes| Yes|
47e41f4b71Sopenharmony_ci   | batchInsert | Yes| Yes| Yes|
48e41f4b71Sopenharmony_ci   | getType | Yes| No| No|
49e41f4b71Sopenharmony_ci   | getFileTypes | Yes| No| No|
50e41f4b71Sopenharmony_ci   | normalizeUri | Yes| Yes| Yes|
51e41f4b71Sopenharmony_ci   | denormalizeUri | Yes| Yes| Yes|
52e41f4b71Sopenharmony_ci   | openFile | Yes| No| No|
53e41f4b71Sopenharmony_ci   | call | Yes| No| No|
54e41f4b71Sopenharmony_ci   | executeBatch | Yes| No| No|
55