Supported Constructs
The following LLBLGen Pro Designer constructs are supported for Entity Framework Core v2. Using an element not on this list will result in a validation error of the project.
Supported designer features
- Entity mappings to tables and views (see below)
- Single catalog per project
- Multi-schema per project
- Entity inheritance: target per Entity Hierarchy inheritance
- 1:1, 1:n, m:1 relationships. Many to many relationships aren't supported by EF core.
- Typed Lists
- Typed Views mapped to tables and views.
- 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 4.6.1 or higher.
- 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.
Supported databases
The following databases are supported. Although there's an EF Core provider for MySQL from DevArt, it's not supporting .NET core.
- SQL Server 2000 and higher
- PostgreSql (using Npgsql)
- Firebird
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. It is required to have at least one identifying field specified in the entity as the entity mappings are defined as 'ToTable()' and not as the new 'ToQuery' (which is used by Typed view mappings). To map a database view as a readonly element, use a Typed View instead.
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'.
It's always required to have at least one field set as identifying field for an entity, even if it's mapped to a view.
Value conversions through type converters.
EF Core 2.1 introduces 'value conversions' which are supported through type converters. Below is the complete list of supported type converters and their EF Core 2.1 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.