1e41f4b71Sopenharmony_ci# DataAbility Switching
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ciThe DataAbility component in the FA model corresponds to the DataShareExtensionAbility component in the stage model.
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciThe DataShareExtensionAbility class provides system APIs. Only system applications can create DataShareExtensionAbility instances. Therefore, DataAbility switching adopts different policies for system applications and third-party applications.  
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## Switching a DataAbility for a System Application
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ciThe procedure for switching a DataAbility for a system application is similar to the procedure of PageAbility switching.
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci1. Create a DataShareExtensionAbility in the stage model.
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci2. Migrate the DataAbility code to the DataShareExtensionAbility.
17e41f4b71Sopenharmony_ci     
18e41f4b71Sopenharmony_ci     The table below describes the lifecycle comparison of the DataAbility and DataShareExtensionAbility.
19e41f4b71Sopenharmony_ci     | DataAbility| DataShareExtensionAbility| Comparison Description|
20e41f4b71Sopenharmony_ci   | -------- | -------- | -------- |
21e41f4b71Sopenharmony_ci   | onInitialized?(info: AbilityInfo): void | onCreate?(want: Want, callback: AsyncCallback&lt;void&gt;): void<br> | The two methods have the same invoking time but different input parameters. In the stage model, the **want** parameter is added so that you can obtain parameters during creation.|
22e41f4b71Sopenharmony_ci   | update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback&lt;number&gt;): void | update?(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket, callback: AsyncCallback&lt;number&gt;): void | The two methods have the same meaning and invoking time, but slightly different parameter sequence and parameter type. A simple reconstruction is required.|
23e41f4b71Sopenharmony_ci   | query?(uri: string, columns: Array&lt;string&gt;, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback&lt;ResultSet&gt;): void | query?(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array&lt;string&gt;, callback: AsyncCallback&lt;Object&gt;): void;| The two methods have the same meaning and invoking time, but slightly different parameter sequence and parameter type. A simple reconstruction is required.|
24e41f4b71Sopenharmony_ci   | delete?(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback&lt;number&gt;): void | delete?(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback&lt;number&gt;):| The two methods have the same meaning and invoking time, but slightly different parameter type. A simple reconstruction is required.|
25e41f4b71Sopenharmony_ci   | normalizeUri?(uri: string, callback: AsyncCallback&lt;string&gt;): void| normalizeUri?(uri: string, callback: AsyncCallback&lt;string&gt;): void| The two methods have the same meaning, invoking time, and parameters.|
26e41f4b71Sopenharmony_ci   | batchInsert?(uri: string, valueBuckets: Array&lt;rdb.ValuesBucket&gt;, callback: AsyncCallback&lt;number&gt;): void | batchInsert?(uri: string, values: Array&lt;ValuesBucket&gt;, callback: AsyncCallback&lt;number&gt;): void| The two methods have the same meaning and invoking time, but slightly different parameter type. A simple reconstruction is required.|
27e41f4b71Sopenharmony_ci   | denormalizeUri?(uri: string, callback: AsyncCallback&lt;string&gt;): void | denormalizeUri?(uri: string, callback: AsyncCallback&lt;string&gt;): void | The two methods have the same meaning, invoking time, and parameters.|
28e41f4b71Sopenharmony_ci   | insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback&lt;number&gt;): void | insert?(uri: string, value: ValuesBucket, callback: AsyncCallback&lt;number&gt;): void | The two methods have the same meaning and invoking time, but slightly different parameter type. A simple reconstruction is required.|
29e41f4b71Sopenharmony_ci   | openFile?(uri: string, mode: string, callback: AsyncCallback&lt;number&gt;): void | NA | The stage model does not support cross-process URI access. You are advised to use [the **want** parameter to carry the file descriptor and file information](file-processing-apps-startup.md) for cross-process file access.|
30e41f4b71Sopenharmony_ci   | getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void | NA | The stage model does not support cross-process URI access. You are advised to use [the **want** parameter to carry the file descriptor and file information](file-processing-apps-startup.md) for cross-process file access.|
31e41f4b71Sopenharmony_ci   | getType?(uri: string, callback: AsyncCallback&lt;string&gt;): void | NA | The stage model does not support cross-process URI access. You are advised to use [the **want** parameter to carry the file descriptor and file information](file-processing-apps-startup.md) for cross-process file access.|
32e41f4b71Sopenharmony_ci   | executeBatch?(ops: Array&lt;DataAbilityOperation&gt;, callback: AsyncCallback&lt;Array&lt;DataAbilityResult&gt;&gt;): void | NA | This method is not provided in the stage model. You need to implement the functionality based on service functions.|
33e41f4b71Sopenharmony_ci   | call?(method: string, arg: string, extras: PacMap, callback: AsyncCallback&lt;PacMap&gt;): void | NA | This method is not provided in the stage model. You need to implement the functionality based on service functions.|
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci## Switching a DataAbility for a Third-Party Application
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ciIn the stage model, third-party applications cannot provide data services for other third-party applications. You can select a switching solution based on your service requirements.
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci| Service Type| Switching Solution|
41e41f4b71Sopenharmony_ci| -------- | -------- |
42e41f4b71Sopenharmony_ci| Providing data for third-party applications| Match a scenario-specific [ExtensionAbility](../reference/apis-ability-kit/js-apis-bundleManager.md#extensionabilitytype).|
43e41f4b71Sopenharmony_ci| Providing data within the application| Extract the component code as a common module for other components to use.|
44