Q2 2012

Jun 11, 2012

What's new in Telerik OpenAccess ORM Q2 2012

FIXED
  • ADO API: Executing a stored procedure throws security exception under medium trust if the DbType of the OAParameter is not set explicitly. - A stored procedure with a parameter that does not have its DbType explicitly defined used to throw security exceptions due to a ComposableType implementation that demands Full trust.
  • ADO API: The OAConnection.StoreConnection.StateChange event not fired - The OAConnection.StoreConnection.StateChange event was not fired when the connection state changes. The 'StoreConnection' property now returns the underlying ADO connection instead of a wrapped LoggingDbConnection instance.
  • Attributes Mapping: If there is no explicit table defined for an entity, it was not consider a part of the model in runtime - In case there is no explicit table defined for an entity, it was not considered at all in runtime. This has been fixed and tables for such entities are now auto-generated as expected.
  • Backend Configuration: Support for xml based configuration of the BackendConfiguration - Provided support for merging backend configuration settings from an xml file in addition to currently available object API. This allows for easily reconfiguring important settings such as logging, caching, etc.
  • Backend Configuration: Improved exception in the case the configuration section is not found - In case where a user would merge the backend configuration from the app.config (or web.config) and there is no 'openAccessConfiguration' section present in the configuration file, a NullReferenceException was being thrown. The correct exception in this case is the ConfigurationException.
  • DataServices: Properties marked as private in the designer are exposed through the service - Non-public properties are now not included in the service metadata, as this used to cause serialization exceptions and a faulty service.
  • Enhancer: The enhanced assembly damaged if persistent field is passed by ref into a generic method - If a persistent field is passed by ref into a generic method and changed inside, the field was not marked as dirty. Whenever the field is passed by ref to a function OpenAccess now marks it as dirty. Additionally the assembly could have contained broken IL code.
  • Enhancer: Code coverage results damaged during enhancing - If an enhanced assembly is tested and code coverage is enabled, the method names are modified. That makes it impossible to analyze the coverage results. A new mono cecil version fixes this problem and is now integrated into OpenAccess.
  • Enhancer: Delayed signed information is removed - If the key file contains only the public part of the key, the enhancer used to remove the strong name.
  • Enhancer: Overriding the enhancer.exe path with relative one results in compile time errors - If a relative path to the enhancer is specified, either in the OpenAccess.targets file or in the project file that includes it, a compilation error was produced stating that the executable cannot be found.
    Workaround: remove the check at the end of the OpenAccess.targets file.
  • FetchPlan: Potential wrong evaluation of fetch plans when explicit path includes were used - When the FetchPlan includes an explicit path, this non-associative part could have been potentially undetected due to an internal set issue if given as the last element in the fetch plan groups.
  • Fluent: Configuration for array properties not taken into account during schema creation - Specific configurations for array properties are now respected when generating schema.
  • Fluent: Creating a model can throw a comparer exception in .NET 4.5 - The FluentMetadataSource used to crash in certain configurations when used in .NET 4.5.
  • Fluent: Order of properties used in a MapJoinTable(string, Expression) sometimes not respected. - The order of the properties passed in the expression that defines the columns in a JoinTable is sometimes not respected.
  • Fluent: Using HasField resulted in lost properties mapping in the case of Vertical or Flat inheritance. - Using HasField both in the base in derived classes of either a Vertical or Flat inheritance resulted in the properties mapped in the derived classes to not be skipped.
  • Fluent: Configuration for array properties not taken into account during schema creation - Specific configurations for array properties are now respected when generating schema.
  • LINQ: Incomplete detection of client side evaluatable enumerable methods. - Enumerable methods that can be evaluated completely on the client were not reliably detected, leading to 'XXX on the database server side currently not implemented' exceptions.
  • LINQ: InvocationExpression not handled properly, leading to exceptions - When an InvocationExpression is used in a LINQ query, the handling of the parameters was not correct, leading to exceptions like ArgumentOutOfRangeException.
  • LINQ: Calling ToString() on value types on the server leads to wrong SQL generation - When an expression of kind 'from x in context.X where x.avalue.ToString() == param select x' is given, the translation of the ToString() on the database server has regressed for MSSQL so that invalid SQL is produced.
    Workaround: If possible, use the real type in the param, not a string.
  • LINQ: Conditions not working on collection items from a SelectMany result - When a LINQ expression similar to .SelectMany(x => x.Details).SingleOrDefault(det => det.Prop == param) is made where the result of a SelectMany is further filtered, an exception is thrown during translation to SQL.
  • LINQ: Ordering on grouped queryables leading to exception - When a grouped queryable is ordered, the ordering conditions can not include anything but the grouping key, otherwise an exception was thrown.
    Hint: It is currently not possible to efficiently handle grouped and then ordered queryable, although the LINQ syntax allows this. On a relational server, the ordering can at most include the projected columns, thus the key of the grouping. If some other ordering condition is given (like a field when the grouping key was a reference), the relational server will need to be accessed again. This leads to 1+n+n queries.
  • LINQ: Support for base Enumerable.Contains(value) as needed for array handling - When a base type array is used as a persistent field like Guid [] pc.myGuids, expressions like .Where(pc => ((IEnumerable<Guid>)pc.myGuids).Contains(new Guid("abc-def"))) are now allowed.
    Workaround: Use IList<Guid> instead as the persistent class field type.
  • MSSQL: If a table has a database generated primary key (IDENTITY column) and also a trigger then inserting into this table resulted in an exception. - In SqlServer if a table has a database generated primary key (IDENTITY column or uniqueidentifier column with newsequentialguid() as the default value) and also an enabled trigger then inserting into this table resulted in an exception with the message - "The target table 'tableName' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause."
  • MSSQL: Schema Read: Unable to resolve the 'identity' setting for a column in a table with a schema name that contains a dot (.) - In Ms SqlServer, if a schema name contains a dot (.) then the 'Identity' setting for column(s) within tables in this schema was not read.
  • MySql: Custom builds of MySql not supported - If the OpenAccess Free Edition is used with a MySql server that was build from the downloaded sources, an Exception of type Telerik.OpenAccess.Exceptions.LicensingException was thrown. Workaround is to use a pre-build MySql versions from the community page.
  • OpenAccessLinqDataSource: Update fails when one of the properties of the updated object is read-only - In case the updated object, has one or more properties that are not updateable, the OpenAccessLinqDataSource tried to insert null for the value of those properties when Update operation is executed. The correct behavior is to preserve the actual value of the updated object instead of overriding it with null.
  • PostgreSql: Incorrect migration script generated related to a serial column - If a byte field is mapped to an autoinc column in a Postqres database, an unnecessary schema migration script was being generated.
  • PostgreSql: Schema read does not recognize schemas that a user has access to - The schema read process is now able to detect the schemas that a user (who is not owner of the schema) has been given access to.
  • Oracle: Reading the 'SYS' schema for Oracle 10 databases could cause an exception - An "Unable to retrieve database schema information" exception was thrown if the SYS schema for Oracle 10 was read.
  • L2 Cache cluster: .NET 4.5 installation breaks MSMQ - The OpenAccess cluster synchronization was broken because of a bug in .NET 4.5 that replaces the .NET 4.0 System.Message dll.
  • Runtime: Damaged SQL prepared statements - If a SQL statement generation fails during the first parameter generation, it was possible to be reused and cause double parameter exceptions later.
  • Runtime: Failing schema read for ADS when using composite function based indexes - The schema read process for ADS databases used to cause an exception when an index is defined that has a function definition for the second or latter columns.
  • Runtime: Metadata error during runtime can be hidden - Sometime important metadata errors were being hidden behind a string format exception.
  • Runtime: Misconfigured type converter used on the parameter when a comparison was made against a string.ToUpper/ToLower on a persistent field - When a LINQ expression involved something like 'x => x.field.ToLower() == param', the parameters converter was not properly initialized from the fields converter. This can lead to suboptimal performance on Oracle, where indexes are skipped by the query optimizer due to wrong parameter types being used (NVARCHAR2 vs VARCHAR2).
  • Runtime: Ordered collections not accessible if empty - Ordered collection that are ordered by a base class field might have thrown a row not found exception if lazily loaded and empty.
  • Runtime: Retrieving of an instance can load data that is not in the fetch plan - Retrieve operations could follow additional references, even when they are not in the fetch plan, causing unnecessary server queries.
  • Runtime: SqlGeometry forward mapping - if an SqlGeometry type is forward mapped, the default mapping to 'geometry' was not found. This lead to mapping problems.
  • Runtime: StoredProcedure generation won't work with inheritance in shared field scenarios - CUD stored procedures generated for derived classes having shared fields caused the generation of duplicate parameters.
  • Runtime: Incorrect handling of fixed size character/binary columns - When a char(x) or binary(x) column is used, the contents of the non-first row to be inserted in a commit can be truncated to the length of the value inserted in the first row.
    Workaround: Use varchar instead of char or use the VariableLengthStringConverter.
  • Runtime: Using Fetch Strategy on collection fields can lead to invalid collection content to be read - When a collection field is prefetched by a fetch strategy, the collection content can be wrong. This only happens if the FetchStrategy is three levels deep and the second level instance is fetched twice.
  • Runtime : Values are inserted in a wrong order in a join table that maintains an m:n collection - An M:N collection is maintained using a join table. If one of the persistent types in an m:n relation has a composite primary key the order in which the values are inserted into the join table is not reliable. This could lead to Foreign Key constraint violations. The order is dependent on the order of the mapping specified for the association, in the association editor.
    This has now been fixed so that the columns are always inserted in the right order.
  • Runtime: A one-to-many collection maintained using a 'fake' inverse reference field was not managed even though the 'IsManaged' property for the association is set to true - A 1-n collection can be managed with an inverse reference field which is defined on the "Many" side of the collection. It is possible to have this setup without actually having a field defined on the Many side; in this case OpenAccess would maintain an internal reference to maintain this collection. If the 'IsManaged' property for such a collection is set to 'true' it is ignored by the runtime (unless the field is defined on the Many side).
  • Runtime: Concurrent usage of MetadataSource can lead to missing metadata - When a MetadataSource (required to interpret the .rlinq file content at runtime) is used in a concurrent fashion, there is a time window in which threads obtaining metadata can find an empty MetadataContainer instances, thus leading to later exceptions during runtime.
    Workaround: Force the MetadataSource to create it's model from a single-threaded place before an OpenAccessContext is obtained.
  • Table editor: Updating tables does not edit the rlinq file explicitly - When a table is edited in the table editor,the rlinq file was not marked as modified(the * sign is not present). In this case, if the user closes the rlinq file, he was not prompted to save it which lead to the changes done in the table editor being lost.
  • Upgrade References: The Telerik.OpenAccess.DataServices reference was not updated - The "Upgrade References" command (found in the Telerik -> OpenAccess menu) can now update references to the Telerik.OpenAccess.DataService binary.
  • Visual Designer: The 'order-by' attribute in the collection element of the .rlinq file is not deserialized - It is possible to define an ORDER BY clause that will be applied to the query when an inverse collection of an object is being fetched. This ORDER BY clause can't be currently specified via the Visual Designer UI assets, but it can be set manually in the .rlinq xml. When a user manually sets the clause, the value is serialized in the 'order-by' attribute of the 'collection' element, but the value is not deserialized.
  • Visual Designer: Keyboard input blocked after executing the Update Database from Model wizard - If the project containing the OpenAccess domain model is bound to TFS and a new DDL script is created via the Update Database from Model wizard, Visual Studio used to display the following message while being closed:
    Microsoft Visual Studio has detected that an operation is blocking user input. This can be caused by an active modal dialog or a task that needs to block user interaction. Would you like to shut down anyway?

Enhancements

  • Runtime: Support for one-to-one associations - OpenAccess is now able to map one to one associations out of the box.
    Database first scenarios - a 1:1 relationship defined in the database using a foreign key constraint between primary keys of the tables involved is automatically detected and mapped to an appropriate association between the 2 domain classes in the domain model.
    Model first scenarios - creating a 1:1 association between primary key members in the designer generates the appropriate tables and foreign key constraint in the database.
    Limitations in this version:
    - One-ended associations with a navigation member only on the referenced class are not currently supported.
    - Limited support in the Fluent API.
  • Visual Studio 2012 RC: Full functional support - Introducing improved project templates for both Web Application and Web Sites, to resemble the newly redesigned ones by Microsoft. Fixed various issues related to integration of OpenAccess in all wizards and dialogs (including the new Add OpenAccess Service wizard, the RIA service generation, the Batch Operations dialog and others).
  • Add OpenAccess Service: Various improvements in the wizard UI and code generation assets- Improved overall state of the UI, redesigning the service selection page, added usability improvement to the entities selected, enhanced inline validation. Fixed issues with Rest and Atom services related to entity operations and warnings in generated code. UnitOfWork now properly generated in cases of fluent. Improved support for Visual Studio 2012 (fixed a lot of issues related to the handling of Visual Studio assets).
  • Add OpenAccess Service: Enable usage of customized in-project code generation templates - Support for using custom templates in the Add OpenAccess Service wizard has been introduced. One can simple add these templates in a folder named OpenAccessTemplates in the desired project and they will be picked up by the user.
  • Add OpenAccess Service: Navigation Properties support and generation - Provided support for navigational properties in the WCF Plain Service code generation of the Add OpenAccess Service wizard. The collections and references are not populated by default, however this can be easily done.
  • Add OpenAccess Service: Support for WCF Data Services 5 with OData v3 - Added a new option in the Add OpenAccess Service wizard that allows for easy configuration of an OData v3 enabled service with the WCF Data Services 5 implementation.
  • Database Default Values support - Default values defined on the database columns can now be reverse mapped with OpenAccess. All the columns that have a default value are marked with HasDefaultValue=True in the Domain Model. Such columns will be skiped during insert should they have no other value specified.
  • Fluent: Enhanced support for defining indexes for various backends - Support for defining sort order on columns has been added to the index functionality exposed by the Fluent Mapping API. This resulted in a breaking change in the object API, more specifically the MetaIndex type.
    Example: classConfiguration.HasIndex()
                            .WithMember(x => x.FirstIndexColumn).Ascending()
                            .WithMember(x => x.SecondIndexColumn).Descending()
                            .WithName("indexName");
  • Provide the ability to use autoinc for Oracle and Firebird using triggers and sequences/generators - OpenAccess now provides out-of-the-box support for automatically incremented keys in Oracle and Firebird. The corresponding Identity Mechanism setting on the Domain Class is 'DatabaseServerCalculated'.
  • Availability of original values - A new method GetOriginalValue<T>(object persitentObject, string propertyName) has been implemented that allows retrieving of the original value for a property that has been already changed. The original value is now available regardless of its current state (loaded or not). If the value is not loaded an additional trip to the database is done in order to load the value. This method will work for all concurrency control types via the property MaintainOriginalValues available on the context.
  • Sequential GUID support - SQL server provides GUIDs as primary keys. Nevertheless not all kinds of GUIDs can be stored without performance overhead. The fastest way is to use server side generated sequential GUIDs. OpenAccess is now able to support primary-key columns that store sequential GUIDs generated by the server. It is now possible to Forward and Reverse map a System.Guid identity field to a 'uniqueidentifier' column where the value is generated on the server and the generated value is successfully retrieved after insert.
  • Context Options: Data Synchronization Setting is added - A option has been added that turns off the internal calculation of the following types of members:
    - members for versioning
    - members used as timestamp
    - DateTime members that are marked with AutoSet on Update, Insert or both
    Usage Example:
    context.ContextOptions.EnableDataSynchronization = true;
  • Runtime: Detached tracked data - OpenAccess can now detach objects from an active OpenAcess context. Those objects are context independent but nevertheless have change tracking that helps preserve the changes to that object for future use. The detached objects can be used to implement scenarios where the data is needed for a long time while the context and underlying database connection are not. The new DetachCopy method on the context instances will generate self tracking copies of persistent objects that can later be attached with all their changes back to an active context using the AttachCopy method on that context.
    Currently attaching object that are new and not previously detached is not possible, however this will be made available in the upcoming service pack.
  • Batch Operation Dialog: Numerous fixes related to search and filter and to available operations- Fixes related to wrongly applied filter conditions, fixes for operations including "Change CLR Type", "Change Cache Strategy" and other visual glitches.
  • Convert from Entity Framework (LINQ to SQL) Wizard: Improved support for many-to-many associations- Added improved support for translating many-to-many associations. Fixes issues with generated code in Visual Basic. Various visual glitches fixed.
  • Model Settings Dialog: Minor fixes and improvements - Changing the Backend setting now correctly updates the ProviderName. Added missing and improved overall state of tooltips. Fixed dialog behavior when started through the Properties Pane.
  • Profiler: Numerous fixes and usability improvements applied to the application - Fixed issue that caused the StackTrace to be always available. Filtering of events used to break navigation back and forth from SQL and Linq events. Fixed issues with sorting and filtering in the grids. Fixes issues causing crashes when loading metrics.
  • Update Database From Model: Improved stability and UI fixes- Fixed crashes caused by devArt's MySql driver in the case the trial license has expired. Fixes possible issues when using the wizard with an Oracle backend. Improved validation for the Destination folder control. Fixed issue with Visual Studio 2008 and radio buttons on the first page.
  • Validation: Improvements in the validation framework- Overall improvements in validation rules applied to the model. Fixed a couple of visual issues with the validation dialog.
  • Association editor: Added support for one-to-one association and improved validation for the wizard- The association editor can now create all kinds of relation including one-to-one (with the exception of a one-to-one association without a source member). Improved validation for the join table combo box control and for association end names in the case of a self-referencing association.
  • Stored Procedure Editor: Improvements to the dialog and generated code- Provided support and code generation for Oracle stored procedures that return result sets. Fixed issue with Complex types, that required restart of Visual Studio. Fixed issue with procedures using System.Byte[]. Improved validation rules in the dialog.
  • Fluent Code Generation: Numerous fixes and improvements- Provided support for column with the type DateTimeOffSet. Now producing compilable code for char and ulong properties. Fixed issue with concurrency mode Backend and a concurrency member of types Int64 and timestamp . Now properly taking into account the OrderBy clause of navigation members. The generated FluentMetadataSource is now a partial class and only picks up properties generated by the designer and correctly leaves out the ones defined in partial classes.
  • Fluent: Support for disabling the resolution of mapping configurations from the assembly - A boolean flag (source.ResolveAssemblyConfigurations) has been added to the FluentMetadataSource that allows for disabling the assembly resolution of MappingConfiguration objects.
  • Fluent: Support for extensible compile-time validation for the FluentMetadataSource - An additional build step in the form of a MSBuild task has been added that can execute the validation rules provided the a FluentMetadataSource over its model and report the errors in the error pane.
    Usage: In order to use this functionality one has to override the GetValidationRuleProvide method in their source and provide an additional MSBuild property ValidateMapping that is set to true
  • Fluent: Support for multiple Fluent Metadata sources in a single project - Support for enhancement of multiple Fluent Metadata sources in a single project has been added. It is now possible for mapping produced by them to overlap (i.e. classes are mapped in both sources).
  • Runtime: Improve handling when wrong type is used while creating a LINQ entry point - When an IQueryable<T> is generated for a type by the user, the type T was not checked until the query is executed. Now the type is checked and an unknown or unenhanced type is reported. This applies also for artificial types, where there is a chance that the types FullName is ambiguous. When there is a difference in the definition of the artificial type, two types will be available at runtime, both potentially having the same full name.
  • Runtime: Memory usage optimization - Provided some memory usage optimizations that can improve the overall performance.
  • Runtime: Improved performance for all fetch operations - Caused by a potentially inefficient GetHashCode() implementation the first level and the second level cache as well as the fetching code could get inefficient dictionary operations. Most likely this occurred with small integer values. In a specially crafted test case we observed a decreased execution time by 70%.
  • Runtime: Improved shared columns functionality - The functionality to work with shared columns has been improved. It is now possible to share a column with one simple field and one or more references (using this column as a foreign key). Reference-reference shared scenarios are possible as well as support for shared columns over class hierarchies.
  • Runtime: Metadata update in open database instances - If a module with OpenAccess persistent classes has to be lazily loaded, OpenAccess had no mechanism to add this new metadata to the running application. A smarter startup and module load mechanism is introduced to reduce the startup time and memory consumption during such operations.
  • Runtime: Unique Id generation functionality - OpenAccess has the functionality to generate unique values for a persistent objects based on the HIGHLOW key generation algorithm. This functionality was so far used internally, for generation of primary keys of persistent objects. Now the unique id generation functionality is exposed via an API using which unique values can be obtained for any user-specified sequence.
  • Data Services: Support for the newly released WCF Data Service 5 with OData v3 - The OpenAccessDataService<T> implementation is now available for WCF Data Services 5 in the Telerik.OpenAccess.DataServices.50 assembly.
  • Data Services: OpenAccessDataService does not allow custom service operations - Fixed an issue that prevented users from extending WCF DataServices with additional service operations. Now you can add custom service operations to WCF DataService version 2 and greater.
  • LINQ: Support for string.Equals(left,right,comparison) was added - Support for string:Equals(string left, string right, StringComparison comparison) was added.
  • LINQ: Incorporate client side support for binary not operation - Included support for client side evaluated binary not operations as in
    int clientValue = 0x1234;
    ctx.Descriptions.Where(d => d.MyIntValue == ~clientValue) ...
    to search for bit-negated values (e.g. the negated value here is 0xFFFFEDCB).
  • LINQ: Server side execution of 'System.Linq.Enumerable:Select(IEnumerable`1,Func`2) for persistent collections - Support was added for query expressions involving System.Linq.Enumerable:Select(IEnumerable<T>, Func<T,S>) like
    string m = "France";
    var q = from city in Scope.Extent<Country>()
    where city.Neighbors.Select(x => x.Name).Contains(m)
    from x in city.Subs
    select x.Name;
  • SDK: Various improvement and bug fixes to the examples- Small fixes introduced in the Sofia Car Rental Silverlight, ASP.NET MVP and ASP.NET Ajax examples. Added validation to the booking page in the Sofia Car Rental MVC example and to the Data Binding with OpenAccessLinqDataSource example.
Have a feature request?

Post your feedback via the Data Access feedback portal or the public forums

What's new across all Telerik products?

See the updates feed

Next Steps

Download for free

Get your fully functional free copy of Data Access.

Get Data Access Sample Kit

Including demos and articles to get you started.

Suggest new features

Help us shape our roadmap.