Supported Constructs
The following LLBLGen Pro Designer constructs are supported for Entity Framework Core v7.x. Using an element not on this list will result in a validation error of the project.
Supported designer features
- Entity mappings to tables, views and table-valued functions (see below)
- Single catalog per project
- Multi-schema per project
- Entity inheritance: Target per Entity Hierarchy and Target per Entity inheritance
- 1:1, 1:n, m:1 and m:n relationships.
- Typed Lists
- Typed Views mapped to tables, views and table-valued functions.
- Table-valued function calls
- Value Type Definitions. Value Type Definitions are generated as 'Owned types' in the mappings.
- Entity splitting (mapping multiple entities onto the same table with a 1:1 Pk-Pk relationship)
- Derived models
- Sequences
- Model views
- All .NET types for PKs
- Enums (using .typeimports files, see the Designer documentation for details on this).
- .NET 6 and .NET 7
- C# and VB.NET
- Relationship cascade rules
- Action combinations on mappings. See below.
- Type converters using system type converters (resulting in EF Core 'value conversions'). See below.
- Implicit numeric conversions (resulting in a EF Core 'value conversion' using the CastingConverter)
- Lazy loading (through the setting GenerateAsVirtualProperty). See Available output settings.
- Spatial types (SQL Server and PostgreSQL).
- Temporal tables (SQL Server)
Supported databases
The following databases are supported.
- SQL Server 2000 and higher
- PostgreSql (using Npgsql)
- Oracle (using ODP.NET)
- Firebird
Oracle support for Entity Framework Core v6.x+
Although the Oracle provider for Entity Framework Core is distributed via NuGet, the LLBLGen Pro Designer works with a GAC installed Oracle ODP.NET provider. This means you have to install ODP.NET via ODAC from Oracle OTN and make sure the ODP.NET provider is installed in the machine.config.
Starting with ODAC v19, Oracle's 'universal installer' doesn't install the ADO.NET provider dlls in the GAC anymore nor does it add
an entry in the .NET's machine.config file for the DbProviderFactory. To fix that please use the following command line statements on an
elevated command prompt. You have to replace <your user name>
with the username you specified during installation, and the version with the one you're using (e.g.
19.0.0 to 21.0.0)
- Go to:
C:\app\client\<your user name>\product\19.0.0\client_1\odp.net\managed\x64
- To register the managed provider in the GAC, type:
OraProvCfg.exe /action:gac /providerpath:"C:\app\client\<your user name>\product\19.0.0\client_1\odp.net\managed\common\Oracle.ManagedDataAccess.dll"
- To register the DbProviderFactory in the machine.config, type:
OraProvCfg.exe /action:config /force /product:odpm /frameworkversion:v4.0.30319 /providerpath:"C:\app\client\<your user name>\product\19.0.0\client_1\odp.net\managed\common\Oracle.ManagedDataAccess.dll"
For Oracle, the schema name is generated into the ModelBuilder code. This means that if your production system is using a different schema name, you have to rename the schema in the Catalog explorer in the LLBLGen Pro designer. It's therefore also not compatible with a setup where you switch schemas for the same codebase using different connection strings.
Read-only entities
Read-only entities, through the action combinations in the mappings pane of an entity editor, are supported through custom annotations. The supported action combinations are 'Create, Retrieve, Update, Delete' and 'Retrieve'. This is implemented using this code: https://romiller.com/2017/02/14/ef-core-1-1-read-only-entities-extending-metadata-with-annotations/
You can specify an entity as 'readonly' by changing in the entity editor's Mappings tab the allowed action combinations to 'Retrieve' instead of the default 'Create/ Retrieve / Update / Delete'. If an entity is set as 'readonly' the modelbuilder will call the IsReadOnly
extension method on the EntityTypeBuilder
object for the entity. When such an entity is then persisted through SaveChanges()
, it's checked whether the entity type has the readonly annotation set. If so, the SaveChanges()
action is aborted with an exception. The exception is needed because it's not possible to filter out actions on the context, so a silent skip isn't possible.
Mapping entities to a view
It's possible to map an entity to a view and use it as a normal view. If the entity doesn't have at least one identifying field specified, the entity will be seen as a read-only entity, as Entity Framework Core sees all non-key containing elements as read-only.
By default the allowed action for the mapping of an entity onto a view is 'Retrieve'. If the view is setup with instead of triggers to allow insert/update/delete actions, change the allowed actions setting for the entity on the entity's mapping tab to 'Create/Insert/Update/Delete'.
Value conversions through type converters
Below is the complete list of supported type converters and their EF Core counterpart. To use these conversions, either specify the mentioned type converter for a field mapping in the designer, or automate this by defining a type conversion in the project settings for the particular conversion using the type converter from the list below and make sure the project setting Entity Model -> General -> Auto assign type converter to field mapping is set to true.
- BooleanCharYN, which maps to BoolToStringConverter, with the values "Y" and "N".
- BooleanNumeric, which maps to BoolToZeroOneConverter
- ByteArrayString, which maps to BytesToStringConverter
- CharString, which maps to CharToStringConverter
- DateTimeOffsetBinary, which maps to DateTimeOffsetToBinaryConverter
- DateTimeOffsetByteArray, which maps to DateTimeOffsetToBytesConverter
- DateTimeOffsetStringConverter which maps to DateTimeOffsetToStringConverter
- DateTimeBinary, which maps to DateTimeToBinaryConverter
- DateTimeInt64, which maps to DateTimeToTicksConverter
- DateTimeString, which maps to DateTimeToStringConverter
- GuidByteArray, which maps to GuidToBytesConverter
- StringByteArray which maps to StringToBytesConverter, with the value System.Text.Encoding.UTF8.
- TimeSpanString, which maps to TimeSpanToStringConverter
- TimeSpanInt64, which maps to TimeSpanToTicksConverter.
Using Table-valued functions to retrieve typed views and entities
Table-valued functions (TVFs) are mapped through the FromSqlRaw
function on a DbSet<T>
. This means you need to call the generated function for the
TVF to materialize the resultset of the TVF and not use the DbSet<T>
it works on. See the following example, which maps a typed view on the
resultset of the TVF dbo.ufnGetContactInformation
, which accepts an int parameter as input. To fetch the TVF's resultset use the following code:
using(var ctx = new MyGeneratedDbContext(connectionString))
{
// pass 10 as the parameter value of the function.
var results = ctx.UfnGetContactInformation(10).ToList();
// do something with results
}