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<void>): 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<number>): void | update?(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket, callback: AsyncCallback<number>): 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<string>, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback<ResultSet>): void | query?(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<Object>): 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<number>): void | delete?(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>):| 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<string>): void| normalizeUri?(uri: string, callback: AsyncCallback<string>): void| The two methods have the same meaning, invoking time, and parameters.| 26e41f4b71Sopenharmony_ci | batchInsert?(uri: string, valueBuckets: Array<rdb.ValuesBucket>, callback: AsyncCallback<number>): void | batchInsert?(uri: string, values: Array<ValuesBucket>, callback: AsyncCallback<number>): 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<string>): void | denormalizeUri?(uri: string, callback: AsyncCallback<string>): void | The two methods have the same meaning, invoking time, and parameters.| 28e41f4b71Sopenharmony_ci | insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback<number>): void | insert?(uri: string, value: ValuesBucket, callback: AsyncCallback<number>): 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<number>): 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<Array<string>>): 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<string>): 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<DataAbilityOperation>, callback: AsyncCallback<Array<DataAbilityResult>>): 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<PacMap>): 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