This content is archived. See latest version here

This section describes how to work with the Business Meta Model from Business Foundation (BF). For information on how to work with data through business objects refer to Working with Entity Objects. All classes are available in the Mediachase.BusinessFoundation.Data.Meta and Mediachase.BusinessFoundation.Data.Meta.Management namespaces.



MetaType represents these field type declarations: string, HTML text, number, enums, file, image etc. MetaType includes all common types and can be extended with UI friendly types. For example, instead of using one type of string, the Business Meta Model has Short String, Long String, HTML, Email and Phone number. You can easily create a new MetaType based on a system type or a customized type.


MetaEnum represents enumerations which can be single or multi-select. When a new meta enum is created, a new meta type is also registered.


MetaClass represents a class containing a collection of meta fields. You can use a meta class to create an entity object. You can modify meta class fields (add, remove) at runtime.

Business Foundation supports 1-N, N-N and aggregation references between two meta classes.


These represent customized extensions and can be installed in the system and activated in the meta class.

Default modules are:

  • Change Tracking - adds a new field to meta class and registers user and date time of modification.
  • History - saves meta object modifications to the history meta class.
  • Localization allows localized field values.


The Business Meta Model uses an SQL Server database for data storage. To manually prepare the database, run the "SqlTables.sql", "SqlSp.sql" and "SqlInitialData.sql" scripts. These will create the infrastructure for the meta model data storage.

Only one Business Meta Model can exist in a database.

A DataContext object represents a unique entry point to the Business Meta Model. When you create an instance of DataContext, Business Meta Model is loaded and all properties are set to their initial values. Then you should initialize DataContext.Current static property to declare DataContext in the current thread. The DataContext will be available in the current thread from the DataContext. DataContext static property.

If the DataContext goes out of scope, it will not be closed. Therefore, you must explicitly close the context by calling Dispose.

The DataContext.Current property is a thread save and you should initialize it in all threads. By changing the DataContext.Current property you can connect to different meta models, but only one connection will be active.

Example: The following example initializes DataContext in the current thread:

// Step 0. Connection String
    string connectionString = "Data Source=(local);Initial Catalog=TestDatabase;User ID=sa;Password=;";
    // Step 1. Initiaze Sql Metamodel
    DataContext.Current = new DataContext(connectionString);
In an ASP.NET application, it is recommended to initialize DataContext in the Global. Application_BeginRequest method.

Last updated: Mar 31, 2014