Friday, August 31, 2012

Creating a New Web App

Let’s create a new Web Site Factory project.

Start Code On Time web application generator and select Web Site Factory under New Project.

Creating a Web Site Factory project on the Start Page of Code On Time web application generator.

The next page will prompt to specify a name and programming language of the project.

Select the programming language of your choice and specify the following name:

Property Value
Name MyProject1

Assigning a name and programming language to the new project.

Press Create button to create the project.

The next page allows changing the Namespace and the version of Microsoft .NET Framework. Leave the default values and press Next.

Configuring the namespace and .NET Framework for the project.

This page allows specifying the Data Provider and Connection String. Select your data provider from the list.

This tutorial uses Microsoft SQL Server database engine. If you do not have a database server, consider installing Microsoft SQL Server 2012 Express.

Click on the button to the right of the Connection String field to open the Connection String Configuration page.

Selecting a Data Provider and activating the Connection String Configurator.

If you have SQL Server Express edition, specify the following:

Property Value
Server .\SQLEXPRESS
Database Northwind
Sample Tables Northwind

To the right of Database field, click on the Create button and confirm to create the database.

Creating a new database on the specified server on the Connection String Configuration page.

To the right of the Sample Tables dropdown, press Install and confirm to populate the project database with the Northwind dataset.

Installing Northwind database tables and data into the specified database.

Code On Time does not offer tools to design databases. Use your favorite database management tools, such as Microsoft SQL Server Management Studio, to work with the database schema.

Our application will have built-in user and role management system. Code On Time applications rely on the security infrastructure available in ASP.NET.

Under Membership section, press Add and confirm to add ASP.NET Membership to the database.

Adding ASP.NET Membership to the database.

You will see a confirmation when the membership has been configured.

Press OK to finish configuration of the database connection string.

Configuration of the database connection string has been finished in a Code On Time web application.

If you are using a trial version of the application generator, the project size is limited to 10 tables or views. To select a subset of tables for the project, click the Change button next to “All database tables and views are included in this project”. Include the following tables: Categories, Customers, Employees, EmployeeTerritories, Order Details, Orders, Products, Shippers, Suppliers, and Territories.

Selecting database tables and views to include in the project.

Press Next twice to reach the Reporting configuration page. Enable dynamic and static reports in the application.

Enable reporting by checking the box on the Reporting Page of the Project Wizard.

Hold down Shift key and press Next – this will skip directly to the Summary page. Press the Generate button to start creation of the web application.

Summary page of the Project Wizard.

When generation is complete, the web site will open in your default browser.

Web Site Factory web application running in a web browser.

Sunday, August 26, 2012

New Update Delivery Engine

Occasionally developers need to downgrade to the previous release of the application generator and code generation library when newly introduced features are interfering with project implementations. Code On Time release 7.0.1.0 introduces support for seamless downgrading and upgrading.

If you need to downgrade the product, then uninstall the application generator, navigate to http://codeontime.com/releases/application-generator, and choose the required version.

Upgrading of the application generation does not require uninstalling the previous version.

The following product enhancements and bug fixes are also included:

  • Enhancements to many-to-many field processing to prevent exceptions in business rules.
     
  • "Code" rules will include parameters derived from data controller fields if the type of the field is not Byte[] or Object and the field is not marked as on-demand.
     
  • App generator starts IIS Express on demand without starting the default website.
     
  • Windows Installer now shows the current version of the installed application generator.
     
  • Charts are now generated synchronously to prevent incorrect class naming in projects with large number of charts.
     
  • Enhancements to "Select" action processing.
     
  • Sql and Code business rules support implementation of server-side multi-field copy.
     
  • Report action will close a modal confirmation controller.
     
  • Various improvements to method parameter binding mechanism in Business Rules.
     
  • Business rules will bind arguments of server methods to action argument values and external values.
     
  • Code and SQL business rules can now be used to process "New" and "Select" events on the server. The phase of the business rule must be set to "Execute" for the method to be invoked. Server-side processing of “Edit” action has been removed from the application framework and replaced with “Select”.
     
  • Adding a data field directly to any category in a multi-category form works correctly.
     
  • Reporting and Export actions correctly apply access control rules.
     
  • Dalibor Uremović has contributed Croatia (hr) localication files. Thank you!
     
  • Action "Roles" property is correctly saved by designer.
     
  • Data field "Alias Field Name" property is correctly saved by designer.

Tuesday, August 14, 2012

Overview of Field Outputs

Field outputs specify the output target of commands with event set to Inserted or Inserting.

The field outputs can be found in the projects based on Microsoft SQL Server in the data controllers based on the tables with identity primary key. The outputs ensure that the ID of a newly inserted record is transferred from the server to the client.

Field Output Properties:

Property Description
Command Specifies the command that outputs data.
Controller Displays the controller that the field output belongs to.
Field Name Specifies which field the command will output data to. Usually specifies the identity-based primary key of the base data table of the data controller.

Learn to work with field outputs in the Project Designer.

Working with Data Fields

Data fields are bindings of fields to views.

Form views organize data fields in categories. Data fields are placed directly under the root of other types of views.

Data fields selected under c1 category of editForm1 view in the Categories controller in the Project Explorer for web applications.

Creating a Data Field

Data fields are created by using the New Data Field context menu option. For grid views, the option is available on the view node.

New Data Field context menu option on a grid view in the Project Explorer.

For form views, the option is available on the category node.

New Data Field context menu option for a category in a form view.

Data fields can also be created by dragging a field node onto the target view or category node.

Dropping a field node onto a view node in the Project Explorer.     Data field CategoryID has been created in grid1 view.

Arranging Data Fields

Data fields can be rearranged using drag and drop operations. Dropping a data field on another data field will place it after the target.

Dropping a data field onto another data field in the Project Explorer.     The data field CategoryName has been placed after data field Description.

Dropping a data field on the right side of another data field will also place it after the target.

Data field Description dropped on the right side of CategoryName data field.     Description data field node placed after CategoryName data field node.

Dropping a data field on the left side of another data field will place it before the target.

Dropping Picture data field on the left side of Description data field.     Picture data field has been placed before Description data field.

Dropping a data field on a different category within the same view will move the data field to that category.

Dropping Picture data field onto category c2 in the same view.     Picture data field has been moved into category c2.

Dropping a data field onto a different view or category will copy the data field. If the data field is already present in the view, it will be moved to the bottom of the list.

Dropping data field Picture onto view grid1.      The existing Picture data field has been moved to last in the list.

Creating Master-Detail Relationships

Dragging data fields can quickly create master-detail relationships between data views. Simply drag the foreign key field from the child view onto the master view. The relationship will be automatically configured.

Dropping a primary key data field onto the master data view.      The data views have been configured with a master-detail relationship.

Deleting a Data Field

Data fields can be removed using the Delete context menu option.

Delete context menu option for a data field in the Project Explorer.

Working with Data Fields in Designer

Data fields are bindings of fields to views.

In the Project Designer, data fields can be found on the Data Fields tab of a view properties page.

Data Fields tab on View properties page.

Data fields in form views can also be found on the category properties page.

Data Fields tab on category properties page.

All bindings of a field to data controller views can be found on the Data Fields tab of a field properties page.

Data Fields tab on Field properties page.

A new data field can be created using the action bar option New | New Data Field.

New Data Field action bar option in the Project Browser.

The properties of a data field can be viewed and edited by clicking on the Field Name or using context menu option Open.

Open context menu option in the Project Browser.     Data Field properties page open in the Project Browser.

The Sync context menu option will select the relevant data field node in the Project Explorer.

Sync context menu option for a Data Field in the Project Browser.     Relevant data field node selected in the Project Explorer.

Data fields can be rearranged using drag and drop operations in the Project Explorer.

EmployeeID data field dropped on the right side of OrderDate data field.     EmployeeId data field placed after OrderDate in the list of data fields in the Project Explorer.

Remove a data field by selecting Delete context menu option in the Project Explorer.

Delete context menu option in the Project Explorer.

Use Navigate To window to quickly locate data fields by their property values.

LastName data field found using Navigate To window using the search terms 'lastname editform1'.

Overview of Data Fields

A data field is a binding of a field to a data controller view. Only one binding of a field can exist in each view. Data fields in form views are organized in categories. The data controller will automatically bind primary key fields and alias fields to a data view if the corresponding data fields are not explicitly defined.

If the value of a field is required for a business rule implementation but should not be displayed to the user, then the data field binding must be created and marked as hidden.

If the field has read roles specified and the user is not matched to the roles, then the data field will become invisible. If the field has write roles specified and the user is not matched to the roles, then the data field will be rendered as read-only.

Data fields can be dynamically rearranged with the help of data controller virtualization.

Data Field Properties:

Property Description
Aggregate Function Specifies a function that will be performed on the rows in grid view. The value will be displayed at the bottom of the grid.
Alias Specifies an alias for the field. The alias will be used to display values. The header text of the alias will be used.
Auto Complete Minimum Prefix Length Specifies the number of letters required for auto-complete to be displayed. If less than 1, auto-complete will be disabled.
Category Displays the category Id that the data field belongs to.
Chart Specifies the role the data field will play in the chart.
Code Filter Specifies the behavior of the filter expression.
Columns Specifies the width of the data field.
Controller Displays the controller that the data field belongs to.
Data Format String Specifies a string that will be used to format the field before presentation.
Data Type Displays the type of the field.
Field Name Specifies the field that the data field will reflect.
Filter Expression Specifies when records will be displayed based on field values.
Footer Text Specifies the text displayed under the field in the user interface.
Format On Client When disabled, the server will format the field using the specified data format string.
Header Text Specifies the text displayed as a label in the user interface.
Hyperlink Format String Specifies a format string that will be rendered as a link. Field names surrounded by brackets can be used to dynamically populate values.
Read Only When enabled, users will not be able to edit the value. The value will not be passed to the server.
Read-Only When Specifies a JavaScript expression that will allow editing on the field when the expression evaluates to true.
Rows Specifies the height of the data field.
Search Mode Specifies the behavior in the advanced search bar.
Search Options Specifies the options available in the advanced search bar. From here, you can also Disable Auto Complete, Disable Multiple Values, Disable Samples, Enable Auto Complete Anywhere.
Text Mode Specifies the method used to display text values. Available options are: Password, Rich Text, Note, Static.
The field is hidden When enabled, the data field will not be displayed in the user interface.
Tool Tip Specifies text to display when the user mouses over the field.
View Displays the view that the data field belongs to.
Visible When Specifies a JavaScript expression that will display the field when the expression evaluates to true.

Learn how to work with data fields in the Designer.

Learn to drag and drop data fields in the Project Explorer.

Common Tasks:

Task Description
Configure a Password Field Learn how to configure a password data field.
Enable Rich Text Editor Learn how to enable rich text editing on a data field.

Monday, August 13, 2012

Working with Fields

A field represents a column of a data row. There are physical and virtual fields. Virtual fields are not derived from a physical column of a data table – their values are computed at runtime. Bindings of fields to views are called data fields.

In the Project Explorer, fields are contained under the Fields node of a controller. If an asterisk (*) is present after the name of the field, the field is required. The field type and length are displayed in parentheses. Some fields fields may display “read-only” label.

Fields under the Fields node of a controller in the Project Explorer.

Creating a Field

A field can be created by using the New Field context menu option on the Fields node.

New Field context menu option in the Project Explorer.

Moving Fields

Fields can be moved using drag and drop operations.

Dropping a field node onto another field node will place the field after the target field.

CategoryID field dropped on CategoryName field in the Project Explorer.     CategoryID field moved after CategoryName in the Project Explorer.

Dropping a field node on the right side of another field node will place it after the target field.

CategoryName dropped on the right side of CategoryID field.     CategoryName field moved after CategoryID field in the Project Explorer.

Dropping a field node on the left side of another field node will place it before the target field.

Picture field dropped on the left side of Description field.     Picture field node placed after Description in the Project Explorer.

Fields can be copied to a different controller by dragging onto the controller or Fields node. The original field will not be deleted.

Description field dropped on CategorySalesfor1997 controller node.     Description field placed at the bottom of Fields node of CategorySalesfor1997 controller in the Project Explorer.

Creating Data Fields

When fields are dropped onto a view or category, they will be instantiated as data fields in the target view. When the field is dropped onto a form view, the data fields will be appended to the last category.

Dropping two fields onto a view node.     Two data fields created in view1.

Cloning a Field

A field can be copied by dropping onto the controller or Fields node while holding Ctrl key. The name of the clone will be appended with a number, and the new field will be configured as a calculated field that reflects the physical column in the database. Use context menu option Copy on the field and use Paste on the controller or Fields node to create a clone.

Description field dropped on Categories controller node while holding Ctrl key on the keyboard.     Description field duplicated as 'Description_1' in the Categories controller.

Create Standard Validator and Converter

Validation and conversion business rules can be quickly created using the Add Validator and Add Converter context menu options. Code, SQL, and JavaScript options are available.

Add SQL Validator context menu option for a field in the Project Explorer.

When an option is selected, the field is configured as calculated, and a business rule will be created.

Validator for CategoryName field automatically created in the Project Explorer.

Deleting a Field

Fields can be deleted using the context menu option Delete. This will also remove all data fields, items, and field outputs.

Delete context menu option in the Project Explorer.

You can find more about Code OnTime Generator, Data Aquarium Framework, and other great products here.


© 2010 Code OnTime LLC. Intelligent code generation software for ASP.NET. Visit us at http://codeontime.com