Documentation
Home
Evaluation
Summary for programmers
Product limitations
Goals of Axisbase
Quick start
Installation
Using the launchpad and opening databases
Connecting to a sample database
Using building blocks
Planning
Define the purpose
Define the requirements
Borrow existing work
Determine the architecture
Design the data model
Design the process model
Deploy and maintain the product
Tutorials
building blocks
Performing a mailmerge
Bulk e-mailing
Programming
Single-threaded progress indicator in c#
Reference
Database menu items
Import XML
Save Copy As
Integrity Check
Change Password
Database Properties window
Opening the database properties window
Record types tab
Display types tab
Roles and Users tabs
Sidebar tab
Database ID/Links tab
Counters tab
Building blocks
Building blocks window
Editing grids and cells
Hyperlinks and nesting
Data Subset window
Data Outsource window
List window
Window window
Report window
Bulk Operation window
Label Printer window
Choosing a data source
Special topics
Expression syntax
Browse records
Storing building blocks within other building blocks
Programming
Using custom code in building blocks
Using Axisbase as an embedded database
Axis1.Util namespace reference
Axis1.Data namespace reference (Fishnets)
Axis1.Data namespace reference (other)
Axis1.Forms namespace reference
| Using Axisbase as an embedded databaseYou can use Axisbase functionality in your own applications - either the building blocks, the data store, or both. DLLs and NamespacesYou can redistribute the Axisbase DLLs, normally installed in c:\Program Files\Axisbase1. These are:
The c# namespace for each DLL is the same as the DLL name. Please see separate documentation pages for the reference to each namespace. Fish MetaphorIn the Axisbase code, there is a metaphor of "fish in a pond". The fish are records and the pond is the database. The terminology helps differentiate different levels of abstraction. A "fish net" is a way to catch some of the fish from the pond, what is called a data subset in the UI. Naming schemeColumn names: Much of the naming scheme becomes apparent when using the Axisbase client. Typically a data subset creates in-memory tables whose column names follow the pattern AXISID.recordtype.property, such as "IRIS.task.percentcomplete". When a user commits changes, the system figures out what records to save back to based on the column names. Type names: Depending on the context, record types may either be referenced as qualified with the Axis ID (such as "IRIS.task") or just the simple name ("task"). ParametersWhen you enter parameter values in Axisbase, it is using an instance of ParameterShed. (The name comes from the term "watershed", but it is just a collection of parameters.) Each parameter has a name, prompt, data type, and optional value. In persisted form, a parametershed has no values; the values are always supplied at run time. Parameter values can be entered by the user, supplied by code, or supplied by arguments when one building block calls another. Parameter values are used by the AxPond.CatchFish method when it loads data sets based on a fishnet (data subset) that defines parameters. In the Axisbase client, each window displaying one building block has its own parametershed. However, in code, you could just have one global parametershed, or any number. Using the Axis1.Data namespaceThe AxPond class is the database. To create or open a local file database, create an instance of AxLocalPond. To open a remote connection to a database server, create an instance of AxRemotePond. AxLocalPond and AxRemotePond are both derived from AxPond. These code samples show how to connect to databases: //connect to databases Opening a database consumes significant resources, because it loads type information. In a web context where you need to open a connection repeatedly for short durations, you would use a connection pool. In a connection pool, the AxRemotePond instance is re-used when possible for successive calls to web pages. Example usage: //connect using a connection pool Once you have an AxPond instance, you can query it for the available types, display types, linked ponds... //query a pond for types A record type is represented by an instance of AxCompoundType. When you have a record type, you can obtain the names and primitive types of its fields. //2 ways to get a record type You can create or change types. //create a type If you know the key of a record, you can load it, save changes, and delete it. Fish (that is, records) are expressed in hashtables, where the hash keys are the simple unqualified names (the name given in the AxFieldInfo instance.) //load, save, delete a fish with a known key To load records when you don't know the key, you can create an instance of AxFishnet. This has all the capabilities of the data subset building block in the UI. You can then use AxPond.CatchFish() to load the data set based on the fishnet. //load fish using a fishnet (long method) A simpler way to use fishnets in code is by using FishnetBuilder. //load fish using a fishnet (short method) Once you have a data set (possibly obtained from AxPond.CatchFish, or any other source), and you've made changes to it, you can save changes in bulk. The overload of SaveFish that takes a data set argument uses column names to map the changes back to record types and record properties. //change and save a data set When a property of one record references a record of another type, Axisbase can cache the references using AxFishRef and AxTypeRef. AxTypeRef is a container of cached references to one type, while AxFishRef encapsulates one individual reference. The cached references can be used to quickly display text representing the record, in place of the key value. //use AxFishRef / AxTypeRef You can map fields in c# objects to fields in Axisbase records, to allow your objects to be persisted to the database. This is often called "object relational mapping". If you derive persistent classes from AxObjectBase like this: public class Vendor : AxObjectBase ... then you can create, load, and save objects like this: AxLocalPond pond = new AxLocalPond(@"c:\data\iris.axis1", true); An alternative to object relational mapping is serializing c# objects to byte arrays, and saving them in blob properties of Axisbase records. Axisbase provides utility methods for this: //assuming a serializable class Foo and a record type Using the Axis1.Forms namespaceThe Axis1.Forms namespace contains classes for persistent building blocks. These are called "nuts" in code. It contains separate classes for forms and controllers, generally following the Model-View-Controller architecture. All the nuts (building blocks) derive from NutBase. You can create nuts in code, and save them to the database, and they will appear in the Building Blocks window. AxLocalPond pond = new AxLocalPond(@"c:\data\iris.axis1", true); The nut classes mainly contain public fields, and few methods. The NutGroup class is a container for nuts. The Axisbase client only instantiates one instance of NutGroup, no matter how many linked ponds there are. This allows nuts to refer to nuts in other ponds. (The metaphors get strange at times.) You can create the NutGroup instance like this: //obtain a nut from a nutgroup To show one of the Axisbase forms (such as a list or report) in your application, call the form's Execute method. You must implement INutWindowManager and IHelpProvider; often, the main form or MDI form is the best class for this. //show the report The forms can access the AxPond instances via NutGroup.MainPond. |