LLBLGen Pro v4.2 BETA released

Posts   
 
    
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 02-Jun-2014 13:40:51   

This morning we've released LLBLGen Pro v4.2 BETA! The beta is available to all v4 customers and can be downloaded from the customer area -> v4.2 section.

Below is the (long) list of new features and changes. The beta comes with an extensive document which describes the new features in detail. We'll work on the documentation during the beta period so consult the beta document for now.

Please provide feedback! Any feedback will do, also if you think it's just a small nuisance. Please post your feedback in the following forum: http://www.llblgen.com/tinyforum/Threads.aspx?ForumID=55

(If you don't see it, please close your browser and re-connect).

LLBLGen Pro v4.2 beta, what's new / changed.

Main new features / changes

General

  • Allowed Action Combinations: Specify which actions are allowed on an entity instance: Any combination of Create/Read/Update/Delete. Supported on: LLBLGen Pro Runtime Framework (all combinations, R mandatory), NHibernate (CRUD and R). Action Combinations make it easy to define e.g. entities which can only be created or read but never updated nor deleted. The action combinations are defined at the mapping level and checked inside the runtime and are additional to the authorization framework.

Designer

  • Copy / Paste support for all model elements (entity, value type, typed list, typed view, table valued function call, stored procedure call): Paste full (with mappings and target tables) or just model elements, across instances (stand alone designer only) or within the project (VS.NET integration and standalone designer).
  • **Automatic re-apply changed settings on existing project: ** e.g. changing a pattern for a name will reapply the setting on the existing model, making sure the names comply with the setting value.
  • New name patterns for auto-created FK/UC/PK constraints (model first). This makes it possible to define a naming pattern for e.g. FK constraints other than the default FK_{guid}. You can use macros to make sure the FK name reflects e.g. the fields and the tables it is referencing.
  • It's now possible to save search queries in the project file.
  • Ability to define default constraints for types, per type - DB combination (model first). This makes it possible to for example define a custom type, e.g. EmailAddress, based on the .NET string type, with length 150 and a default of "undefined@example.com" for SQL Server and then define a field in an entity with type 'EmailAddress'. Creating the database tables from this model in the designer will then result in a default constraint on the table field the email address field is mapped on with value "undefined@example.com".
  • **General editors per project element type: ** one editor which is kept open and will show the selected element in the project explorer, making it very easy to check / edit configurations on multiple elements. This will make it possible to e.g. edit or look at mapping data for several entities quickly by opening the general entity editor and opening the field mappings tab while selecting the entities to check / edit in the project explorer: the field mappings tab is kept the tab visible so the data of the selected entity is shown each time.
  • Intellisense helpers in QuickModel for types, names and relationship types: It's now possible to open helper lists of names in scope, types available and the list of relationship types to help you write quick model expressions more easily.
  • Hide / Filter warnings: It's now possible to hide / filter out warnings in the error/warning pane based on warning ID. The hidden/filtered out warnings are viewable again using a toggle and which IDs are filtered out is stored in the project.
  • **Element selection rules on tasks (code generator). ** It's now possible to define selection rules on tasks in a run queue for the code generator which select which elements participate in the task, based on setting values. This makes it easy to define a setting for a user which is then taken into account in the code generator to execute different tasks based on the value of the setting.
  • **New refactoring: replace selected fields with existing value type. ** This makes it easier to work with value types in the designer: if a selected value type matches (based on a set of defined rules) the selected fields, the fields are replaced with the selected value type and mappings are adjusted accordingly.
  • **Automatically assign found sequences to entity fields based on a pattern (database first). ** Based on a name pattern the reverse engineering engine will select fields of entities which should get a sequence assigned to them, if the name pattern resolves to a name of a found sequence. This makes it easier to reverse engineer models from databases which use sequences for identity values, like Oracle and PostgreSQL.

LLBLGen Pro Runtime Framework

  • Expression support during Inserts It's now possible to define an expression on an entity field which is used during inserts. The expression defined is used to produce the field value.
  • Generate Typed Lists as POCO classes with a Linq or QuerySpec query. It's now possible to generate a typed list or all typed lists (controllable through settings) as a simple POCO class which holds the data of a row in the resultset and a Linq or QuerySpec query to execute the typed list.
  • Generate Typed Views as POCO classes and use them in Linq and QuerySpec. It's now possible to generate a typed view or all typed views (controllable through settings) as a simple POCO class and use it in Linq or QuerySpec queries.
  • **Transparent Transient Error Recovery (adapter only). ** The transient error recovery system introduced in v4.1 has been upgraded so it can now be used transparently: define once and it is automatically used when executing a query. It's no longer necessary to explicitly execute a query through a recovery strategy.
  • Cached resultset tagging for easy cache purge/retrieval It's now possible to tag a query's resultset if that resultset is cached so the resultset can be retrieved from the cache using the tag and also it's now possible to purge the resultset(s) associated with the tag from the cache.
  • **Action Combination support (see above). ** It's now possible to define an entity type as e.g. Read Only or Read / Create (or any of the other combinations) and the engine will automatically check at runtime whether an action (e.g. delete of an entity instance) is allowed or not and will deny the action if the action isn't part of the defined allows action combinations of the entity type.

Entity Framework

  • Code First support (Entity Framework v6+) It's now possible to generate Entity Framework v6 code with Code First mappings instead of EDMX using mappings. This allows you to keep using model first or database first modeling techniques in the designer and emit Code First output: POCO classes for the entity model and Code First code defining the model mappings.

NHibernate

  • Support for Read-only entities (See Action Combinations above)
  • String lengths are now emitted into the mappings: The lengths in the mappings make sure NHibernate makes the right decisions at runtime with respect to strings.

Minor features / changes

General

  • Support for <DependentUpon> element in CS/VBProj files (Code generator)
  • Support for default presets (Code generator)

Designer

  • Added a setting to control whether names are singularized during reverse engineering
  • When a relationship is marked as 'ModelOnly', the backing FK (and UC) of the original relationship when it wasn't model only, are now removed from the relational model data if the FK (and UC) are created by the designer and if there's no other model element relying on them (e.g. another relationship). Previously, they're kept around.
  • .NET 4.5.2 has been added as a supported platform
  • A directive has been added to the designer's config file to enable (it's disabled by default) high-DPI winforms support on .NET 4.5.2.
  • Context menus for entities in project explorer and model views have been re-ordered and more commands have been added to make working with the elements through context menus more convenient.
  • Stored procedure call parameters and Table-valued-function call parameters are now selectable in the code generation info tab and settings specifically for these elements will now show up there.
  • SQL Server 2014 is now a supported database (through the SQL Server driver/templates).
  • When a typed view was mapped onto a stored procedure resultset, it will now use the stored procedure name strip pattern instead of the Table Valued Function strip pattern to produce a proper procedure name for the macro {$ProcFunctionName}.
  • The default sorting on the error lister is no longer on 'Time' but on message type, Source so errors appear first, then warnings, and the messages are sorted within the message type on source, ascending.
  • In a typed list, when a relationship join hint was changed, the project wasn't marked as 'changed'.
  • When a project is loaded, all root nodes are now collapsed, which makes it easier to work with larger projects.
  • When a new element is added to the project, e.g. entity or typed view either directly or through reverse engineering, the state of the root nodes are remembered so the root nodes no longer all expand when an element is added, only the root node of the added element(s) is expanded to show the new elements.
  • Setting an existing field to a custom shortcut will set the maxlength/precision/scale In v4.2, setting an existing field to a shortcut which has a default length/precision/scale set will receive these values for maxlength/precision/scale, overwriting an existing value.
  • Multi-line input support in QuickModel: it's now possible to paste multiple lines with quick model statements in the input box, which are then executed one by one
  • Preference names are now beautified. Preferences are now properly word broken and lower cased, and thus easier to read than the previous preferences which were equal to the camelcased property names.
  • Catalog explorer details are now automatically shown when a node is selected if details viewer is open.
  • A 'Collapse Child Nodes' feature has been added to the context menu of certain nodes in project explorer and catalog explorer. All nodes which have child nodes which can have child nodes have now a 'Collapse Child Nodes' feature in their context menu, so it makes it easier to reset the tree to a workable form after many expand actions.
  • PostgreSQL driver now also obtains materialized views as 'views'. Postgresql servers v9.3 or later required.
  • It's now possible to define different default values for resultset retrieval. A driver will retrieve stored procedure resultsets using default values for the parameters of the procedures selected. At the wizard tab for stored procedure selection, the user can now click a button to define different default values for the supported value types (and string), to avoid stored procedures being excluded because they reject the original default values (e.g. a stored procedure which requires a value larger than 0 for an int parameter otherwise it will return with an error will now no longer do so if the default for int is set to a value larger than 0).
  • License file can now also be placed in 'My Documents\LLBLGen Pro'

LLBLGen Pro Runtime Framework

  • QuerySpec: Multiple calls to query.From(operand) are now appending the operand to the existing From clause if operand starts with QueryTarget. If it doesn't start with QueryTarget and there's an existing From clause, it will overwrite the existing From clause.
  • OData: The OData Support Classes now support the IgnorePropertiesAttribute on entity classes. The names specified using the attribute have to be defined on the entity type the attribute is defined on, so inherited properties can't be filtered out using this attribute.
  • Low level api: Duplicate sort clauses are now filtered out so accidentally added duplicates through e.g. OData are no longer causing exceptions at runtime.
  • Dynamic Query Engines: when the source of a field isn't known, the field creator functionality will no longer emit a dangling '.' but will simply only emit the field name/alias. This way constucts like .OrderBy("Name".Ascending()) will work, where the engine will emit ORDER BY [Name] ASC. Previously the above construct would result in ORDER BY .[Name] ASC which would fail.
  • Query traces: The value of a parameter of type DateTime value in a query is now emited as a ISO 8601 / Roundtrip formatted string, which is more precise than the previous 'ToString()' call on the DateTime which didn't include fractions of a second.
  • FunctionMappings added (Linq/QuerySpec): sbyte/byte/ushort/short/uint/int/ulong/long.ToString() mappings have been added to all DQEs for all databases.
  • EntityBase(2).AllowReadsFromDeletedEntities allows code to read from an entity that has been marked as deleted. It's been set to 'false' as the default which will result in an exception if code reads from a deleted entity, like in previous versions.
  • SQL Server 2014 is now a supported database (through the SQL Server DQE/templates). Use 2012 compatibility to utilize the 2012 or higher features.
  • FIX: QuerySpec: A projection lambda was created using a parameter which was created for every new query, which resulted in a new cache key for the lambda so the lambda was compiled every time instead of re-using a cached version. The lambda is now created using the same parameter as the original and the compiled version cached is re-used in subsequential executions of the same projection so query creation is a bit quicker.
  • FIX: QuerySpec: QuerySpec doesn't properly replace function mappings in derived tables. Queries like the following now work:
var qf = new QueryFactory();
var qs = qf.Create("S")
        .Select(DateTimeFunctions.Year(OrderFields.OrderDate).As("YearOrder"));
var q = qf.Create()
        .Select(qf.Field("S", "YearOrder"))
        .From(qs);

  • QuerySpec: There's now a class available to create a projection lambda quickly for Select<T>() calls, called ProjectionLambdaCreator. This class has two overloads of its Create() method which creates at runtime a projection lambda for T from either a specified fields set or a fields creation class (e.g. CustomerFields). The overload which accepts the fields creation class caches the created lambda and is therefore much faster than a lambda created in code and compiled by the C# / VB.NET compiler which will create a new Expression<Func<T>> at runtime each time it is run. usage:
var qf = new QueryFactory();
var q = qf.Create()
        .Select(ProjectionLambdaCreator.Create<OrderPocoQsRow, OrderPocoQsFields>())
        .Where(OrderPocoQsFields.CustomerId == "ALFKI");

Here, the ProjectionLambdaCreator creates a lambda for the OrderPocoQsRow, which is equal to the code below which was what you had to write in v4.1 and earlier:

// equivalent code, prior v4.2
//...
.Select(() => new NW26.Adapter.TypedViewClasses.OrderPocoQsRow()
{
    CustomerId = OrderPocoQsFields.CustomerId.ToValue<System.String>(),
    EmployeeId = OrderPocoQsFields.EmployeeId.ToValue<Nullable<System.Int32>>(),
    Freight = OrderPocoQsFields.Freight.ToValue<Nullable<System.Decimal>>(),
    // etc. all fields specified.
})
//..

The advantage is that the ProjectionLambdaCreator call caches its lambda under the two types specified while the written out lambda creation code will create a new one each time it is run. Running the code about 100,000 times takes 98ms for the ProjectionLambdaCreator and 19832ms for the written out code, so it does make a difference. * QuerySpec: There's now a special Select method available which produces its own lambda projector from two types given:

var qf = new QueryFactory();
var q = qf.Create.Select<SomeDTO, SomeElementFields>();

This method, dynamicQuery.Select<T, U>() creates a projection and projector lambda from T and U for dynamicQuery and makes it a DynamicQuery<T>. The type T is the type of a class which instances are returned by the created DynamicQuery<T>, and can be an entity type or DTO or e.g. generated typed view type. The type U is the type of the generated helper class which creates the fields for T, e.g. CustomerFields. * QuerySpec: The usage of QueryTarget is now also supported in DynamicQuery / DynamicQuery<T> instances, but only in appending join operands to an existing query:

var q = qf.Create()
            .From(qf.Customer.InnerJoin(qf.Order)
                      .On(CustomerFields.CustomerId.Equal(OrderFields.CustomerId)));
//....
q.From(QueryTarget.InnerJoin(qf.OrderDetails)
            .On(OrderFields.OrderID.Equal(OrderDetailFields.OrderId)));

  • QuerySpec. you don't need to create a new field for each targeted subquery field anymore, if you want to effectively clone the projection of a subquery. It's now possible to clone a projection of a derived table/aliased subquery in an outer query's Select() method.
  • It's now possible to generate case insensitive SQL for case sensitive databases using a setting.

Entity Framework

  • It's now possible to define the return type of a fetch method for a stored procedure call which returns a typed view: this is required if the stored procedure has output parameters as Entity Framework doesn't read the output parameters untill the resultset has been enumerated which is too late. The setting controls whether the code generator will generate a work around for this or not. The work around does change the method's return type, hence the setting.
Frans Bouma | Lead developer LLBLGen Pro