Table of Contents

Class RemoteDataContextBase

Namespace
LinqToDB.Remote
Assembly
linq2db.dll
public abstract class RemoteDataContextBase : IDataContext, IConfigurationID, IDisposable, IAsyncDisposable, IInfrastructure<IServiceProvider>
Inheritance
object
RemoteDataContextBase
Implements
Extension Methods

Constructors

RemoteDataContextBase(DataOptions)

protected RemoteDataContextBase(DataOptions options)

Parameters

options DataOptions

Properties

CloseAfterUse

Gets or sets flag to close context after query execution or leave it open.

public bool CloseAfterUse { get; set; }

Property Value

bool

ConfigurationString

Gets initial value for database connection configuration name.

public string? ConfigurationString { get; set; }

Property Value

string

ContextIDPrefix

protected abstract string ContextIDPrefix { get; }

Property Value

string

Disposed

protected bool Disposed { get; }

Property Value

bool

InlineParameters

Gets or sets option to force inline parameter values as literals into command text. If parameter inlining not supported for specific value type, it will be used as parameter.

public bool InlineParameters { get; set; }

Property Value

bool

MappingSchema

Gets mapping schema, used for current context.

public MappingSchema MappingSchema { get; set; }

Property Value

MappingSchema

NextQueryHints

Gets list of query hints (writable collection), that will be used only for next query, executed using current context.

public List<string> NextQueryHints { get; }

Property Value

List<string>

Options

Current DataContext LINQ options

public DataOptions Options { get; }

Property Value

DataOptions

QueryHints

Gets list of query hints (writable collection), that will be used for all queries, executed using current context.

public List<string> QueryHints { get; }

Property Value

List<string>

SqlOptimizerType

protected virtual Type SqlOptimizerType { get; set; }

Property Value

Type

SqlProviderType

protected virtual Type SqlProviderType { get; set; }

Property Value

Type

Methods

AddInterceptor(IInterceptor)

Adds interceptor instance to context.

public void AddInterceptor(IInterceptor interceptor)

Parameters

interceptor IInterceptor

Interceptor.

AddMappingSchema(MappingSchema)

Adds mapping schema to current context.

public void AddMappingSchema(MappingSchema mappingSchema)

Parameters

mappingSchema MappingSchema

Mapping schema to add.

BeginBatch()

public void BeginBatch()

CommitBatch()

public void CommitBatch()

CommitBatchAsync(CancellationToken)

public Task CommitBatchAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task

ConfigureAsync(CancellationToken)

Preload configuration info asynchronously.

public ValueTask ConfigureAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancellation token to cancel operation.

Returns

ValueTask

Task which completes when configuration info is loaded.

Dispose()

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

public virtual void Dispose()

DisposeAsync()

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

public virtual ValueTask DisposeAsync()

Returns

ValueTask

GetClient()

protected abstract ILinqService GetClient()

Returns

ILinqService

InitServiceProvider(SimpleServiceProvider)

protected void InitServiceProvider(SimpleServiceProvider serviceProvider)

Parameters

serviceProvider SimpleServiceProvider

RemoveInterceptor(IInterceptor)

Removes interceptor instance from context.

public void RemoveInterceptor(IInterceptor interceptor)

Parameters

interceptor IInterceptor

Interceptor.

ThrowOnDisposed()

protected void ThrowOnDisposed()

UseMappingSchema(MappingSchema)

Sets new mapping schema for current data context.

Implements the Disposable pattern, which must be used to properly restore previous settings.

public IDisposable? UseMappingSchema(MappingSchema mappingSchema)

Parameters

mappingSchema MappingSchema

Mapping schema to set.

Returns

IDisposable

UseOptions(Func<DataOptions, DataOptions>)

Sets new options for current data context.

Implements the Disposable pattern, which must be used to properly restore previous options.

public IDisposable? UseOptions(Func<DataOptions, DataOptions> optionsSetter)

Parameters

optionsSetter Func<DataOptions, DataOptions>

Options setter function.

Returns

IDisposable

Returns disposable object, which could be used to restore previous options.

Remarks

For ConnectionOptions we update only mapping schema and connection interceptor. Connection string, configuration, data provider, etc. are not updatable.

Exceptions

ArgumentNullException