[]
        
(Showing Draft Content)

C1.Data.Entities.EntityClientCache.RegisterContext

RegisterContext Method

RegisterContext(ObjectContext, Type)

Registers an ObjectContext as a default for C1DataSource controls for a given contextType.

Declaration
public static IDisposable RegisterContext(ObjectContext context, Type contextType)
Parameters
Type Name Description
ObjectContext context

An ObjectContext to set as default.

Type contextType

The type (derived from ObjectContext) to register the context for.

Returns
Type Description
IDisposable

An IDisposable to unregister the context.

Remarks

Use this method when you need to customize the default ObjectContext used in C1DataSource controls. Register a custom ObjectContext on startup before any C1DataSource instances are created.

Exceptions
Type Condition
InvalidOperationException

Another context is already registered for the given contextType.

See Also

RegisterContext(ObjectContext)

Registers an ObjectContext as a default for C1DataSource controls.

Declaration
public static IDisposable RegisterContext(ObjectContext context)
Parameters
Type Name Description
ObjectContext context

An ObjectContext to set as default.

Returns
Type Description
IDisposable

An IDisposable to unregister the context.

Remarks

Use this method when you need to customize the default ObjectContext used in C1DataSource controls. Register a custom ObjectContext on startup before any C1DataSource instances are created.

Exceptions
Type Condition
InvalidOperationException

Another context is already registered.

See Also

RegisterContext(DbContext, Type)

Registers an DbContext as a default for C1DataSource controls for a given contextType.

Declaration
public static IDisposable RegisterContext(DbContext context, Type contextType)
Parameters
Type Name Description
DbContext context

An DbContext to set as default.

Type contextType

The type (derived from DbContext) to register the context for.

Returns
Type Description
IDisposable

An IDisposable to unregister the context.

Remarks

Use this method when you need to customize the default DbContext used in C1DataSource controls. Register a custom DbContext on startup before any C1DataSource instances are created.

Exceptions
Type Condition
InvalidOperationException

Another context is already registered for the given contextType.

See Also

RegisterContext(DbContext)

Registers an DbContext as a default for C1DataSource controls.

Declaration
public static IDisposable RegisterContext(DbContext context)
Parameters
Type Name Description
DbContext context

An DbContext to set as default.

Returns
Type Description
IDisposable

An IDisposable to unregister the context.

Remarks

Use this method when you need to customize the default DbContext used in C1DataSource controls. Register a custom DbContext on startup before any C1DataSource instances are created.

Exceptions
Type Condition
InvalidOperationException

Another context is already registered.

See Also