Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
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:
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.
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);
Last updated: Oct 21, 2014