Chapter 11 Generating .NET 2.0 Persistent Objects and Windows Applications
Generating Code for a Smart Device Application
Before generating a smart device application, you must:
- Ensure that you have attached the ADO.NET Compact Framework (and, if you want to generate unit tests, UnitTest.NET Compact Framework) extended model definitions (see Adding ADO.NET or ADO.NET CF support).
- Set any appropriate model properties on the ADO.NET CF and Application tabs, including a functioning connection string (see ADO.NET and ADO.NET CF options).
- Specify appropriate values for the following variables (select Tools→General Options, and click the Variables category):
- CFUT_HOME – if using Microsoft Mobile Client Software Factory CFUnitTester
- ASANET_HOME – if using Sybase ASA. Specifies the location of iAnywhere.Data.AsaClient.dll.
- SQLSERVERMOBILENET_HOME – if using Microsoft SQL Server Mobile Edition. Specifies the location of System.Data.SqlServerCe.dll
- ULTRALITENETCE_HOME – if using Sybase UltraLite. Specifies the location of ulnet10.dll
- ULTRALITENET_HOME – if using Sybase UltraLite. Specifies the location of iAnywhere.Data.UltraLite.dll and en\iAnywhere.Data.UltraLite.resources.dll
To generate code:
- Select Tools →Check Model to verify that there are no errors in the model. If there are errors, fix them before continuing with code generation.
- Select Language→Generate C#2 Code or Generate Visual Basic 2005 to open the Generation dialog box.
- Specify the root directory where you want to generate the code and then click the Options tab.
- Specify any appropriate options and then click OK to generate code immediately or Apply and then Cancel to save your changes for later.
Once you have generated your code, you can deploy it:
To deploy code to a smart device:
- Compile your generated code in Visual Studio.
- Deploy the start up project, i.e. the <model>Test project or User Interface project
- Deploy the SystemFramework project separately with the database file and required DLLs (such as ulnet10.dll for UltraLite support).
To test the application on the device:
- If you have generated and deployed the user interface projects to the device, you can run them and test the application by inputting some data.
- If you have generated for 'Microsoft Mobile Client Software Factory', you can run the unit tests by clicking GuiTestRunner.exe in the deployment folder in the device. The exe file and its references can be copied from the Microsoft Mobile Client Software Factory installation folder.
Copyright (C) 2007. Sybase Inc. All rights reserved.
|
|