Firebird and .NET 2.0 development Example

I completed a small test application with a variety of web pages using common .net controls and demonstrating using Firebird from pure visual coding to developing using custom business objects. The full test application code and all the files necessary to build the sample database can be found here General Firebird Test .NET 2.0 Code.

This sample doesn't do anything really new or extremely complex but it does help show how to work the basics and also points out a few quirks you need to be aware of while developing with Firebird. Some of the ideas handled in this example such as creating an editable GridView and working with business objects and subobjects are usefull even if your not using Firebird.

The application will demonstrate:

  • Setting up a basic SqlDataSource with a GridView for View,Update,Delete.
  • Adding a DetailView for Inserting.
  • Adding a DetailView for all editing and keeping it synchronized with your GridView.
  • Using stored procedures (getting return values, getting result sets, selecting from a stored procedure, to perform inserts and key generation).
  • Using triggers and generators for auto incrementing primary keys.
  • Creating an Editable GridView that does all editing and works more like a spreadsheet.
  • Generating and using Visual Studio's Strongly Type DataSet business classes and using them with ObjectDataSource.
  • Creating our own custom business objects and using them with ObjectDataSource.
  • Reviewing a variety of ways to access look values or subobjects on business objects.

The following files come with the example in addition to the website code:

  • OfficeTest.Sql: Script for building the OfficeTest database used for this example code.
  • OfficeTestData.Sql: Script for adding default data to the OfficeTest database.
  • OfficeTest.IBW: IBDataWorks schema file for the OfficeTest database.
  • OfficeTest.fdb.Backup: Transportable backup of my working database. Can be used to directly restore the database on your server.
  • OfficeTestSchema.jpg: Image of the schema produced from IBDataWorks.
  • OfficeTestSchema.svg: Scalable Vector Graphics of the schema produced from IBDataWorks. Can be viewed in most browsers.
  • InsertProcWithGenerator.js: JavaScript used for generating the Stored Procedures. This script is used by IBDataWorks and already exists in the OfficeTest.IBW file.
  • InsertTriggerWithGenerator.js: JavaScript used for generating the Triggers. This script is used by IBDataWorks and already exists in the OfficeTest.IBW file.
  • C#BusinessObject_Data.js: JavaScript that will generate code for custom business objects. The script can be loaded into IBDataWorks as a Tool and then used to generate C# code for business objects for all tables selected in the schema.
  • C#BusinessObject_List.js: JavaScript that will generate code for custom business object container classes. The script can be loaded into IBDataWorks as a Tool and then used to generate C# code for business objects for all tables selected in the schema.

To get started you need to extract the zip file contents where you want the code or move the code to your development directory. Once you've done that use either the OfficeTest.Sql and OfficeTestData.Sql or the OfficeTest.IBW to generate your database. You could also just retore the OfficeTest.fdb.Backup to your server.

Now open the Web.config file and modify the connection string to point to your OfficeTest database on your server or local machine. Make sure to modify the user/password settings to match yours.

You may also notice in the <compilation> tag references to assemblies. The PublicKeyToken matches my machine. You need to modify these for your machine. The easiest way to do this is just delete these entries and once you load the project up in Visual Studio manually add the FirebirdSql.Data.FirebirdClient and FirebirdSql.Web.Providers dlls to your project. You do this by right-clicking on the project in the solutions explorer and selecting "Add Reference".

Well this is all I have time for right now. You have the code and you know what it does and how to set it up. That should be enough to get most people going. Over the next week I'm going to add links to this page for various tutorials on each section of the code.

OfficeTest General Tests Code Tutorials


AttachmentSize
generaltests.zip150.63 KB