.NET Framework This feature is not supported by the .NET Framework implementation of the Data Provider.
As discussed in the Overview, Entity Framework Core works with the EFCore Provider to interpret the LINQ to Entities queries and other Entity Framework Core features contained in an application to SQL statements compatible with the Teradata SQL Engine. The EFCore Provider uses the Data Provider to communicate with the SQL Engine. In order to use the EFCore Provider, an application must do the following:
- Create a Model that is specific to the SQL Engine.
- Connect to a SQL Engine using the EFCore Provider.
- Use the features of Entity Framework Core and EFCore Provider to submit data to and retrieve data from the SQL Engine.
Most methods implemented by the EFCore Provider are implemented in the Microsoft.EntityFrameworkCore namespace. The DbFunctions extensions accessible via the EF.Functions class are implemented in the Teradata.EntityFrameworkCore namespace.
Context Configuration
The DbContextOptionsBuilder extension UseTeradata is provided to configure the context to connect to a Teradata SQL Engine. See the Example for details.
Model Configuration
The following ModelBuilder extensions are provided to configure the model:
- ForTeradataUseIdentityByDefault: Configures the model to use the Teradata Identity Column feature to generate values BY DEFAULT for key properties marked as ValueGenerated.OnAdd. This is the default behavior when targeting Teradata SQL Engine.
- ForTeradataUseIdentityAlways: Configures the model to use the Teradata Identity Column feature to generate values ALWAYS for key properties marked as ValueGenerated.OnAdd.
The following ModelBuilder extensions are provided to configure the default database object in which the model may be stored:
- ForTeradataUseStorageOptions: Configures the storage options for the database object in which the model is stored. The parameter accepts a string that should contain the desired storage options in the following format: "PERM = ...[ SPOOL = ...][ TEMPORARY = ...]". NOTE: The storage options string is required if the default database does not exist.
- ForTeradataUseFallbackProtection: Configures the Fallback Protection for the database object in which the model is stored. If the value is true, Fallback Protection will be enabled. If the value is false, Fallback Protection will be disabled. Fallback Protection is disabled by default.
- ForTeradataUseAccountString: Configures the Account String for the database object in which the model is stored.
- ForTeradataUseBeforeJournal, ForTeradataUseAfterJournal, and ForTeradataUseDefaultJournalTable: Configures the Before and After Journal and the default journal table for the database object in which the model is stored.
The following ModelBuilder extensions are provided to configure any schema objects in which the model may be stored:
- ForTeradataSchemaUseStorageOptions: Configures the storage options for the database object in which the schema is stored. The parameter accepts a string that should contain the desired storage options in the following format: "PERM = ...[ SPOOL = ...][ TEMPORARY = ...]". NOTE: The storage options string is required to create the database object in which the schema is stored.
- ForTeradataSchemaUseFallbackProtection: Configures the Fallback Protection for the database object in which the schema is stored. If the value is true, Fallback Protection will be enabled. If the value is false, Fallback Protection will be disabled. Fallback Protection is disabled by default.
- ForTeradataSchemaUseAccountString: Configures the Account String for the database object in which the schema is stored.
- ForTeradataSchemaUseBeforeJournal, ForTeradataSchemaUseAfterJournal, and ForTeradataSchemaUseDefaultJournalTable: Configures the Before and After Journal and the default journal table for the database object in which the schema is stored.
Entity Configuration
The following EntityTypeBuilder extensions are provided to configure the entities:
- ForTeradataAllowDuplicates: Configures the table kind for the table object that the entity maps to. If the value is true, a MULTISET table is created. If the value is false, a SET table is created. By default, the table kind depends on the Session Mode: MULTISET in ANSI, SET in Teradata. The table kind cannot be modified using migrations after the table is created.
- ForTeradataUseFallbackProtection: Configures the Fallback Protection for the table object that the entity maps to. If the value is true, Fallback Protection will be enabled. If the value is false, Fallback Protection will be disabled. By default, Fallback Protection is inherited from the Model.
- ForTeradataUseBeforeJournal, ForTeradataUseAfterJournal, and ForTeradataUseJournalTable: Configures the Before and After Journal and the journal table for the table object that the entity maps to.
Property Configuration
The following PropertyBuilder extensions are provided to enable functionality specific to the Teradata SQL Engine:
- ForTeradataUseIdentityByDefault: Configures a key property to use the Teradata Identity Column feature to generate values BY DEFAULT for new entities when targeting the Teradata Database.
- ForTeradataUseIdentityAlways: Configures the key property to use the Teradata Identity Column feature to generate values ALWAYS for new entities when targeting the Teradata Database.
- ForTeradataUseRowVersion: Configures the property to emulate the RowVersion/Timestamp feature using triggers. This extension must be used instead of the IsRowVersion() Fluent API or [Timestamp] attribute, which are not supported.
- ForTeradataIsCaseSensitive: Sets case sensitivity for a character property.
Spatial Data
Support for Spatial Data is provided via a separate NuGet package Teradata.EntityFrameworkCore.NetTopologySuite. It provides the following TeradataDbContextOptionsBuilder extension:
- UseNetTopologySuite: Use NetTopologySuite to access Teradata SQL Engine spatial data (Geospatial types and functions).
In This Section
Data Type Mappings
CLR Methods and Properties and LINQ to Entities Functions
Teradata SQL Engine Functions
NetTopologySuite Translated Operations