Table of Contents

Class ScaffoldInterceptors

Namespace
LinqToDB.Scaffold
Assembly
linq2db.Tools.dll

Base class for scaffold customizations. Constains virtual methods with no-op implementation for each customization point.

public abstract class ScaffoldInterceptors
Inheritance
ScaffoldInterceptors
Extension Methods

Methods

AfterSourceCodeGenerated(FinalDataModel)

Event, triggered after source code generation done. Provides access to database model objects with final types and names set. Could be used to establish link between database object and generated code.

public virtual void AfterSourceCodeGenerated(FinalDataModel model)

Parameters

model FinalDataModel

Database model descriptors.

GetAggregateFunctions(IEnumerable<AggregateFunction>)

Using this method you can add, remove or modify aggregate function schema information.

public virtual IEnumerable<AggregateFunction> GetAggregateFunctions(IEnumerable<AggregateFunction> functions)

Parameters

functions IEnumerable<AggregateFunction>

Aggregate function schema, provided by schema provider.

Returns

IEnumerable<AggregateFunction>

Aggregate function schema with interceptor logic applied.

GetForeignKeys(IEnumerable<ForeignKey>)

Using this method you can add, remove or modify foreign key constrains schema information.

public virtual IEnumerable<ForeignKey> GetForeignKeys(IEnumerable<ForeignKey> keys)

Parameters

keys IEnumerable<ForeignKey>

Foreign key schema, provided by schema provider.

Returns

IEnumerable<ForeignKey>

Foreign key schema with interceptor logic applied.

GetProcedures(IEnumerable<StoredProcedure>)

Using this method you can add, remove or modify stored procedure schema information.

public virtual IEnumerable<StoredProcedure> GetProcedures(IEnumerable<StoredProcedure> procedures)

Parameters

procedures IEnumerable<StoredProcedure>

Stored procedure schema, provided by schema provider.

Returns

IEnumerable<StoredProcedure>

Stored procedure schema with interceptor logic applied.

GetScalarFunctions(IEnumerable<ScalarFunction>)

Using this method you can add, remove or modify scalar function schema information.

public virtual IEnumerable<ScalarFunction> GetScalarFunctions(IEnumerable<ScalarFunction> functions)

Parameters

functions IEnumerable<ScalarFunction>

Scalar function schema, provided by schema provider.

Returns

IEnumerable<ScalarFunction>

Scalar function schema with interceptor logic applied.

GetTableFunctions(IEnumerable<TableFunction>)

Using this method you can add, remove or modify table function schema information.

public virtual IEnumerable<TableFunction> GetTableFunctions(IEnumerable<TableFunction> functions)

Parameters

functions IEnumerable<TableFunction>

Table function schema, provided by schema provider.

Returns

IEnumerable<TableFunction>

Table function schema with interceptor logic applied.

GetTables(IEnumerable<Table>)

Using this method you can add, remove or modify table schema information.

public virtual IEnumerable<Table> GetTables(IEnumerable<Table> tables)

Parameters

tables IEnumerable<Table>

Table schema, provided by schema provider.

Returns

IEnumerable<Table>

Table schema with interceptor logic applied.

GetTypeMapping(DatabaseType, ITypeParser, TypeMapping?)

Using this method you can specify which .NET type and DataType enum value to use with specific database type. Method called only once per database type. CLRType shouldn't be a nullable type, as nullability applied to it later automatically based on owning object (e.g. column or procedure parameter) nullability.

public virtual TypeMapping? GetTypeMapping(DatabaseType databaseType, ITypeParser typeParser, TypeMapping? defaultMapping)

Parameters

databaseType DatabaseType

Database type specification.

typeParser ITypeParser

Type parser to create value for CLRType property from Type instance or type name string.

defaultMapping TypeMapping

Default type mapping for specified databaseType.

Returns

TypeMapping

Type mapping information for specified databaseType.

GetViews(IEnumerable<View>)

Using this method you can add, remove or modify view schema information.

public virtual IEnumerable<View> GetViews(IEnumerable<View> views)

Parameters

views IEnumerable<View>

View schema, provided by schema provider.

Returns

IEnumerable<View>

View schema with interceptor logic applied.

PreprocessAggregateFunction(ITypeParser, AggregateFunctionModel)

Using this method user could modify aggregate function code generation options:

public virtual void PreprocessAggregateFunction(ITypeParser typeParser, AggregateFunctionModel functionModel)

Parameters

typeParser ITypeParser

Type parser service to create type tokens.

functionModel AggregateFunctionModel

Function model descriptor.

PreprocessAssociation(ITypeParser, AssociationModel)

Using this method user could modify association code generation options:

Also it is possible to modify set of columns, used by association, but it is probably not very useful.
public virtual void PreprocessAssociation(ITypeParser typeParser, AssociationModel associationModel)

Parameters

typeParser ITypeParser

Type parser service to create type tokens.

associationModel AssociationModel

Association model descriptor.

PreprocessEntity(ITypeParser, EntityModel)

Using this method user could modify entity code generation options:

  • modify associated table/view metadata descriptor: Metadata
  • modify entity class code generation options including custom attributes: Class
  • modify/add/remove data context table access property: ContextProperty
  • edit list of generated Find/FindAsync/FindQuery extensions: FindExtensions
  • modify column list: Columns including column metadata and property code generation options.
public virtual void PreprocessEntity(ITypeParser typeParser, EntityModel entityModel)

Parameters

typeParser ITypeParser

Type parser service to create type tokens.

entityModel EntityModel

Entity model descriptor.

PreprocessScalarFunction(ITypeParser, ScalarFunctionModel)

Using this method user could modify scalar function code generation options:

public virtual void PreprocessScalarFunction(ITypeParser typeParser, ScalarFunctionModel functionModel)

Parameters

typeParser ITypeParser

Type parser service to create type tokens.

functionModel ScalarFunctionModel

Function model descriptor.

PreprocessStoredProcedure(ITypeParser, StoredProcedureModel)

Using this method user could modify stored procedure code generation options:

  • Return parameter descriptor: Return
  • Return tables (data sets) descriptor: Results
  • Error, returned by data set schema load procedure: Error
  • Metadata (procedure name): Name
  • Method code-generation options: Method
  • Parameters: Parameters
public virtual void PreprocessStoredProcedure(ITypeParser typeParser, StoredProcedureModel procedureModel)

Parameters

typeParser ITypeParser

Type parser service to create type tokens.

procedureModel StoredProcedureModel

Stored procedure model descriptor.

PreprocessTableFunction(ITypeParser, TableFunctionModel)

Using this method user could modify table function code generation options:

  • Function metadata: Metadata
  • Return table descriptor: Result
  • Error, returned by data set schema load procedure: Error
  • Metadata (function name): Name
  • Method code-generation options: Method
  • Parameters: Parameters
public virtual void PreprocessTableFunction(ITypeParser typeParser, TableFunctionModel functionModel)

Parameters

typeParser ITypeParser

Type parser service to create type tokens.

functionModel TableFunctionModel

Function model descriptor.