November Happy Hour will be moved to Thursday December 5th.

Class DataContext

Provides meta data entry point.

Inheritance
System.Object
DataContext
Implements
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Mediachase.BusinessFoundation.Data
Assembly: Mediachase.BusinessFoundation.Data.dll
Version: 13.30.0
Syntax
public class DataContext : IDisposable
Remarks

You should initialize Current in current thread to start Mediachase Ibn Data.

Constructors

DataContext(String)

Initializes a new instance of the DataContext class.

Declaration
public DataContext(string connectionString)
Parameters
Type Name Description
System.String connectionString

The connection string.

Fields

SystemUser

Defines system user constant.

Declaration
public static readonly object SystemUser
Field Value
Type Description
System.Object

Properties

Attributes

Gets the attributes.

Declaration
public AttributeCollection Attributes { get; }
Property Value
Type Description
AttributeCollection

The attributes.

Cache

Gets or sets the cache.

Declaration
public DataContextCache Cache { get; }
Property Value
Type Description
DataContextCache

The cache.

Current

Gets or sets the current.

Declaration
public static DataContext Current { get; set; }
Property Value
Type Description
DataContext

The current.

CurrentUserId

Gets or sets the current user id.

Declaration
public object CurrentUserId { get; set; }
Property Value
Type Description
System.Object

The current user id.

Remarks

DataContext.SystemUser is default value.

CurrentUserTimeZone

Gets or sets the current user time zone.

Declaration
public TimeZone CurrentUserTimeZone { get; set; }
Property Value
Type Description
System.TimeZone

The current user time zone.

Remarks

System.TimeZone.CurrentTimeZone is default value. You can use Mediachase.BusinessFoundation.Data.UserTimeZone to create custom time zone.

Item[String]

Gets or sets the System.Object with the specified attribute key.

Declaration
public object this[string attributeKey] { get; set; }
Parameters
Type Name Description
System.String attributeKey
Property Value
Type Description
System.Object

MetaModel

Gets the meta class manager.

Declaration
public virtual MetaClassManager MetaModel { get; }
Property Value
Type Description
MetaClassManager

The meta class manager.

SqlContext

Gets the SQL context.

Declaration
public SqlContext SqlContext { get; }
Property Value
Type Description
SqlContext

The SQL context.

Methods

BeginTransaction()

Begins the transaction.

Declaration
public virtual TransactionScope BeginTransaction()
Returns
Type Description
TransactionScope

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()

Dispose(Boolean)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

FromConfig()

Froms the config.

Declaration
public static DataContext FromConfig()
Returns
Type Description
DataContext

GetMetaClass(String)

Gets the meta class.

Declaration
public MetaClass GetMetaClass(string metaClassName)
Parameters
Type Name Description
System.String metaClassName

Name of the meta class.

Returns
Type Description
MetaClass

GetMetaFieldType(String)

Gets the type of the meta field.

Declaration
public MetaFieldType GetMetaFieldType(string metaFieldTypeName)
Parameters
Type Name Description
System.String metaFieldTypeName

Name of the meta field type.

Returns
Type Description
MetaFieldType

GetMetaView(String)

Gets the meta view.

Declaration
public MetaView GetMetaView(string metaViewName)
Parameters
Type Name Description
System.String metaViewName

Name of the meta view.

Returns
Type Description
MetaView

GetModuleDataStorage(String)

Gets the module data storage.

Declaration
public ModuleDataStorage GetModuleDataStorage(string moduleName)
Parameters
Type Name Description
System.String moduleName

Name of the module.

Returns
Type Description
ModuleDataStorage

InitMetaModel()

Inits this instance.

Declaration
[Obsolete("This method is no longer used. Will remain at least until May 2019.")]
protected void InitMetaModel()

Switch(DataContext)

Switches the specified new context.

Declaration
public static DataContextSwitcher Switch(DataContext newContext)
Parameters
Type Name Description
DataContext newContext

The new context.

Returns
Type Description
DataContextSwitcher

Events

MetaModelLoad

Occurs when meta model is loaded.

Declaration
public static event EventHandler<MetaModelLoadEventArgs> MetaModelLoad
Event Type
Type Description
System.EventHandler<MetaModelLoadEventArgs>

Implements

System.IDisposable