Using Modeling Tools

The AgileFx Modeler

The AgileFx framework includes a modeler, which lets you represent the entities and the relationships that they participate in, using a Data Model.

agilefx modeler

The Mapping between this data model and the relational database is automatically generated by the designer and is stored in an XML format. The Model designer should avoid the need to deal with or understand the generated XML.

LINQ to AgileFx Entities provides LINQ support which enables queries against the AgileFx Model. The Query Builder methods supported with the AgileFx Entities will be covered in the Advanced Queries section.

How do I get the AgileFx Modeler and how do I use it

Installing the AgileFx Framework will install the modeler plug-in for your visual studio enviornment. You can add a new AgileFx Model to your project the same way you would add a new class or an aspx file to the project. This would start a wizard with two choices


agilefx modeler
  • Start with a database first approach - This will prompt for database connection information. Once provided a new "<name provided>.models" file will be added to the project and filled with Entities and Associations generated with the information from the provided database tables. "|Tell about options in generation|"
  • Start with a model first approach - A "<name provided>.models" file will be added to the project. The data model will need to be created using the designer.
  • Once a valid data model has been generated, right click on the model will open up a context menu. The menu will have an option "Generate SQL from Models". This will prompt database connection information. An existing database can be chosen, or a new database with Model name can be created on the local SQL Server.

Making changes to the Model

Updating the domain model can be done by
  • making changes to the database and then importing those updates into the data model by right clicking on the diagram to open up the context menu, which has the option "Update from database scheme". Next the required tables for import can be selected, along with an option where you can specify if inheritance can be auto detected from the tables.

Or
  • making changes to the data model and then generating the SQL scripts to recreate the database. Once the changes are made in the data model, In the designer context menu use the option "Generate SQL From Models" to generate the SQL Script. This script can be run on the database to recreate it. The existing tables will have to be dropped from the database before running the generated scripts.
Options