In the model first approach, you use Entity Data Model Tools to create an empty .edmx
file, and then create the entities, relationships, and inheritance hierarchies required for
your model. Generating a database from the model provides DDL commands that you can execute
in GemFire XD to create the actual schema.
- In the Solution Explorer, right-click your Windows Forms application and select Add > New
- Select ADO.NET Entity Data Model from the Visual Studio installed
- Click Add to display the Visual Studio displays the Entity Data Model
Wizard. You will use this wizard to generate the new model.
- Select Empty Model from the Choose Model Contents window, and click
- Use the Toolbox or right-click the design surface to create the entities and associations
that you want to include in your model. For example:
- Before you generate DDL for your model, be sure to select the SSDLToGemFireXD.tt (VS) option
from the DDL Generation Template menu in the model's Properties panel:
- Right-click in the designer to display the context menu, then select Generate Database
from Model.... This opens a Generate Database Wizard.
- On the Choose Your Data Connection window:
- Click New Connection...
- Click Change... to change the data source.
- Click <other> in the Data source: list.
- Select .NET Framework Data Provider for GemFire XD from the Data provider drop-down
- Click OK to select the provider. The GemFire XD provider is now selected in the
Connection Properties dialog:
- In the Server field, enter the address and port number (separated by a colon) of
the GemFire XD locator or server to use for connecting to the
distributed system. For example, the above screenshot shows a connection
to localhost:1527. Click Test Connection to verify that you can
connect, then click OK to dismiss the test connection and
connection properties dialog boxes.
- Select the Save entity connection settings in App.Config as: dialog box and provide
a name for the settings:
- Click Next to continue. The Generate Database Wizard creates and displays the
GemFire XD DDL commands that are required to create your completed
- Enter a filename for the DDL commands in the Save DDL As: field, and
- If you intend to replace an existing schema with the model you have created,
first backup all data in the existing database tables and drop those tables from
the schema. See Exporting and Importing Data with GemFire XD.
- Execute the DDL file in GemFire XD to create the new schema. For
gfxd run -file="c:\Users\yozie\Documents\Visual Studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Model1.edmx.sql"
- If you replaced an existing schema with the model, import data into the new
tables using the instructions in Exporting and Importing Data with GemFire XD.