MetaModel.RegisterContext Method (Func<Object>, ContextConfiguration)

 

Registers a data-context instance by using the specified context configuration and by enabling a custom constructor.

Namespace:   System.Web.DynamicData
Assembly:  System.Web.DynamicData (in System.Web.DynamicData.dll)

public void RegisterContext(
	Func<object> contextFactory,
	ContextConfiguration configuration
)

Parameters

contextFactory
Type: System.Func<Object>

A delegate that is used to instantiate the data model context.

configuration
Type: System.Web.DynamicData.ContextConfiguration

The context information as defined by the ContextConfiguration class.

Exception Condition
ArgumentNullException

contextFactory is null.

ArgumentException

The contextType that is instantiated by contextFactory is not valid.

The context factory in this method enables you to instantiate a data model context by using a custom constructor.

.NET Framework
Available since 3.5
Return to top
Show: