What’s New in this release

New features in Genome 4.2

4.2: released on 10th of February, 2010 (build 4.2.1.37)

4.2 service release 1: released on 17th of February, 2010 (build 4.2.2.40)

4.2 service release 2: released on 26th of October, 2010 (build 4.2.3.9)

4.2 service release 3: released on 8th of November, 2010 (build 4.2.4.4)

4.2 service release 4: released on 6th of March, 2012 (build 4.2.5.12)

4.2 service release 5: released on 27th of June, 2012 (build 4.2.6.15)

4.2 service release 6: released on 24th of August, 2012 (build 4.2.7.17)

4.2 service release 7: released on 1st of May, 2013 (build 4.2.8.22)

4.2 service release 8: released on 24th of October, 2013 (build 4.2.9.29)

4.2 service release 9: released on 22nd of September, 2015 (build 4.2.10.57)

4.2 service release 10: released on 18th of May, 2016 (build 4.2.11.59)

Visual Studio 2012 compatibility

Genome v4.2.7 provides integration to Microsoft Visual Studio 2012 RTM with the same functionality as for VS2010. Service release 5 and 6 contain only this tool enhancement and no change in the runtime.

Important note: The backwards compatibility issue of Visual Studio 2012 RC has been fixed in RTM, so the workaround of setting the environment variable “MSBUILDENABLEALLPROPERTYFUNCTIONS” is not necessary anymore.

Improvements in testability

With this release we have improved the testability of Genome applications again. We have made efforts to enhance unit testing capabilities and also to make the database integration tests running faster with SQLite in-memory database. The following list contains the most important changes in these topics, and the references to the detailed descriptions.

Stub proxy generation framework

Maybe one of the most important improvements is that we have created a new stub proxy generation framework inside the Genome Testing Extensions package. The created stubs are completely detached from any DataDomain or Context instances, so they behave like a value object or POCO. These stub objects can be used to provide sample domain entities for unit testing.

You can find out more about this feature in the documentation here.

IDataDomain and IConext interfaces

To make it easier to write unit test for codes that uses the DataDomain or the Context classes of Genome, we have introduced two new interfaces (IDataDomain and IContext) that contain all the important methods and properties of the DataDomain and Context classes.

The business logic can be implemented in a way that it depends on the new interfaces, and these dependencies can then be mocked out for a unit test.

The infrastructure for managing the active context (Context.Push(), Context.Current) has been refactored to work with any IContext object, so these infrastructures can be also used in unit tests to inject the mocked IContext object to the application logic.

With this change we had to modify a few methods and properties in the Genome API to use the new interfaces. For the majority of the usages, these changes do not cause any problem, but in some cases the implementation has to be modified slightly when upgrading to Genome 4.2 (see the full list of breaking changes here). As Genome still provides only one implementation for IDataDomain and IContext, these compilation errors can be easily fixed by casting the failing expression to DataDomain or Context or calling the extension methods AsGenomeContext() and AsGenomeDataDomain() that has been defined on the IContext interface.

The new IDataDomain interface does not contain the untyped Extent, New, etc. methods that were used by Genome before the generics have been introduced to .NET. If the application uses heavily these methods, casting back the DataDomain property of the Persistent base-class might affect the major part of the application. As the persistent base class is completely optional for Genome, you can implement a similar base class that uses still the DataDomain class or you can use the following base class that solves this compatibility issue:

    public abstract class CompatibilityPersistent : Persistent

    {

        public new DataDomain DataDomain

        {

            get { return base.DataDomain.AsGenomeDataDomain(); }

        }

    }

IDataDomain.Delete() method

If a part of your business logic needed to create, update and delete persistent objects, previously you had to use both the Context and the DataDomain classes of Genome, as the method for creation (New) was defined on the DataDomain class, but the method for deleting was defined on the Context class.

To reduce the number of dependencies of these codes and making the unit testing easier, we have introduced an additional Delete method on the DataDomain class and on the IDataDomain interface. The additional Delete method is equivalent to the Context.Delete() method, and the old method can still be used.

With this change you can reduce the dependencies to IDataDomain of these business logic methods.

Using SQLite in-memory databases for database integration testing

One of the main problems with writing database integration tests is that the execution of these tests is relative slow. As Genome now provides integration with SQLite databases, and since SQLite supports in-memory databases, we have investigated how this can be used to increase the performance of the database integration tests, even if the application being tested does not use SQLite database to store its data.

We have provided a sample and a step-by-step guidance how you can configure your project for this. The result is promising: we have measured the same integration test running almost 5 times faster with SQLite in-memory databases (running 100 tests in 7 seconds).

Support for SQLite 3 database engine (including in-memory databases)

Genome now supports SQLite 3 databases with the SQLite.NET provider for .NET.

For using SQLite support the desired ADO.NET provider (System.Data.SQLite) and the TechTalk.Genome.SQLiteProvider.dll assembly has to be referenced in the project.

We currently support the 1.0.65.0 version of the SQLite.NET provider which is available here: http://sqlite.phxsoftware.com/.

You can find out more about setting up the provider and using the in-memory mode in the documentation here.

Genome Fluent Mapping Extensions (GFMX)

Genome Fluent Mapping Extensions (GFMX) allow you to map your persistent classes and their members with C# (or other .NET language) code. This makes the mapping more type-safe and provides better integration for different refactoring tools (e.g. rename property). The extension pack can be also used as an example, how different mapping features can be automated.  

The fluent mapping still validated compile-time, so using GFMX does not increase the application load time. Also, it can fully be combined with the classical XML mapping (even for a class) providing full backwards compatibility and a possibility for smooth transition to GFMX.

This is how a simple class mapping looks like with GFMX:

fluentMapping.MapType<User>()

    .AsPersistent()

        .MapMember(u => u.Id).AsPersistentField().WithIdGenerator()

        .MapMember(u => u.FirstName).AsPersistentField()

        .MapMember(u => u.LastName).AsPersistentField()

        .MapMember(u => u.Name).AsLinq(u => u.FirstName + " " + u.LastName)

;

We have provided a sample and a description of the currently supported mapping options in the documentation of this feature here.

Support for Microsoft Visual Studio 2010 and .NET 4.0

It is here! This Genome release can also integrate with Microsoft Visual Studio 2010.

The Genome installer detects the installed Visual Studio versions and providers an option to integrate with the different versions.

If you use the VS2010 integration you can also choose from targeting the old 2.0 CLR (used by .NET 3.5) or the new .NET/CLR 4.0 platform. For newly created projects, this can be done using the framework selector dropdown of the “Add New Project” dialog.

If you want to change the target platform of existing projects, you can use the project properties dialog of the DataDomain schema or the GMX projects.

Please note, that the VS2008 integration might display the assembly references wrongly, as it displays an error marker (exclamation mark) in the reference icon, although the reference is correct. This is only a minor cosmetic issue and the projects can be compiled properly regardless of this problem.

Changes in Oracle database support

The Microsoft OracleClient provider has been deprecated in .NET 4.0. Fortunately this does not mean that you cannot use it anymore, but there will be no more improvements in the provider in the further .NET releases.

We have also stared to prepare for this change. As a first step we have moved our Oracle integration that uses the OracleClient provider into a separate assembly. In the future we will provide an alternative Oracle provider that uses the ODP.NET provider from Oracle.

For the users of Genome who have been using the Oracle provider, the new provider assembly (TechTalk.Genome.OracleProvider.dll) has to be added to the project references of the schema project. The new provider assembly is located in the Bin folder of the Genome installation.

List of breaking changes

The following breaking changes between Genome v4.1 and v4.2 have been introduced and need to be resolved manually when upgrading projects. The changes marked with italic denote major changes.

The majority of the breaking changes are related to the newly introduced IContext and IDataDomain interfaces. See suggestions for upgrade in the chapter above.

Affected feature / API

Change

Oracle database provider

The Genome Oracle database provider has been moved to a new assembly (TechTalk.Genome.OracleProvider.dll).

In order to compile solutions using the Genome Oracle provider this assembly has to be added to the references of the DataDomain schema project.

Context.Current

The return type has been changed from Context to IContext. If this change causes a compilation error in your code, cast the result back to Context or use the AsGenomeContext() extension method.

Context.Pop()

Persistent.PinnedContext

Persistent.EffectiveContext

ContextStack.Current

ContextStack.Pop()

IContextProvider.GetContext()

ISetDataSource.PinnedContext

IPersistentCollection.GetActualContext()

Context.GetEffectiveContext

Set<T>.PinnedContext

SetBindingList<T>.PinnedContext

SetBindingList<T>.ActualContext

IContextBoundObject.Context

Set<T>.Pin()

Parameter type has been changed from Context to IContext

ISetDataSource.Pin()

OptimisticLockingSemantics.GetClientVersion()

SetDataSource.GetActualContext()

The method has been renamed to GetActualGenomeContext()

Persistent.DataDomain

Return type has been changed from DataDomain to IDataDomain. If this change causes a compilation error in your code, cast the result back to DataDomain or use the AsGenomeDataDomain() extension method. You can also consider introducing a backward-compatibility base-class instead of persistent as mentioned above.

IDataDomainBoundObject.DataDomain

IDataDomainBoundDataSource.DataDomain

Context.Get()

Obsolete, use ContextStateServices.GetState() method instead.

Context.Refer()

Obsolete, use ContextStateServices. Refer() method instead.

Context.Change()

Obsolete, use ContextStateServices. OnObjectChanging() method instead.

Context.PropertyChange()

Obsolete, use ContextStateServices. OnPropertyChanging() method instead.

Group by near object references

Genome v4.2.2 and earlier versions were automatically falling back to in-memory implementation in this case. From v4.2.3 an exception is thrown to highlight the potential performance issue. For backwards compatibility set the DataDomainConfiguration.
EnableEvaluatingGroupByInMemory flag to true. (see also issue #1504)

Fixed issues (since Genome 4.1.2)

The following issues have been fixed in Genome 4.2:

·    1200: GDMX: Possibility to automatically add namespace and assembly if a property is created in the code with SqlHierarchyId type

·    1420: Misleading error message for TransientField/LinqInitializer

·    1421: Default initialization for NOR discriminator member might cause a failure during creation

·    1423: SqlCE and MsSql2008 providers are not signed

·    1425: CommitFailed events fired before the database connection is closed

·    1476: GMX: compilation fails with "No DataDomainSchema project found among the referenced assemblies." on x64

·    1479: QueryProvider generated for derived interface does not implement base interface members

·    1481: Prepared query with null value check generates incorrect SQL

·    1483: BoolMapping might not work with MsSql2005

·    1484: Collections of new objects having server-generated id might be cleared after flush

New features in Genome 4.2.3

The following smaller features have been introduced in Genome 4.2.3:

·    1489: Context.ContextType property that returns the type of the context (R/O, LRT, SRT)

·    1495: Using table-valued functions from Genome

·    1499: GMX: Support for nested types

·    1509: GHX: support for polymorphic historized types

·    1518, 1519, 1520, 1521: Mapping feature for the INotifyPropertyChanged interface

Fixed issues (since Genome 4.2.2)

The following issues have been fixed in Genome 4.2.3:

·    1494, 1533: Accessing a pinned collection might lead to context-related errors (ObjectDisposedException, #GEN101)

·    1496: GMX: Compilation errors in the generated file when upgrading to Genome 4.2

·    1497: GMX: Transformation interfaces do not support nested namespaces

·    1498: GMX: Inserting referring entities with the GMX transformation fails if the reference is not nullable

·    1500: DataDomain.Delete(Context) uses the current context

·    1503: Queries with IQueryable<T> subqueries cannot be executed

·    1504: Using a NOR in gorup-by key causes misleading exception (This is a breaking change. Genome can be instructed to fall back to in-memory implementation for these cases (this was the default before v4.2.3). For this please set the DataDomainConfiguration.EnableEvaluatingGroupByInMemory flag.)

·    1507, 1510: Linq mapping with join causes schema load error in .NET 4.0

·    1508: Passing Mapping files through "Additional Parameters" causes compile time error for .Net 4.0 (Visual Studio 2010)

·    1512: Activation tool displays wrong grace period

·    1513: GMLX: GMLX projects does not compile under .NET 4.0

·    1514: .NET 4.0: Single/Double operators are defined as valid operators

·    1516: Boolean mapping fails when selecting boolean with ToObject in selector subquery

·    1522: Context.Pin(Set) overload throws misleading exception

·    1523: Mapping of GUID field in Oracle does not support ANSI parameters (see <GuidStringEncoding/>)

·    1524: SQLite: Mapping decimal fields in Sqlite as NUMERIC or as REAL

·    1528: Compare different subtypes lead to ambiguous operator exception.

·    1529: SQLite: GROUP BY clause is not generated

·    1530: QueryProvider for generic base interface does not compile

·    1531: LINQ: group by  with having clause throws OqlParserException

·    1532: QueryProvider interface cannot inherit mapping from base interfaces

Fixed issues (since Genome 4.2.3)

The following issues have been fixed in Genome 4.2.4:

·    1535: Precaching collections with dynamic extent provider is not reflecting the change of the dynamic extent

·    1536: Genome Express contains Debug statements

·    1537: Calling QueryCacheManager on a precached collection causes duplicated query execuion and assertion failures

·    1538: Collection instance might return not up-to-date items after commit

·    1539: Trace message displayed by default during deserialization

Fixed issues (since Genome 4.2.4)

The following issues have been fixed in Genome 4.2.5:

·    1541: InvalidOperationException (Collection was modified) is thrown during precache

·    1546: Transient struct construction issue

·    1544: Automatic resolution of circular references can cause LockViolationException

·    1545: Oracle: Milliseconds precision is lost when saving

·    1547: WOP projects cannot be loaded in VS2010 if VS2008 integration is not installed

·    1551: QA.exe cannot load schema in .NET 4.0

·    1552: LINQ compatibility issue with IOrderedQueryable

·    1553: Schema Comparison Wizard does not work if VS2008 is not installed

·    1549: Avoid the first-chance SematicException in TechTalk.Genome.Oql.Parser.Internal.OqlAnalyzer

Fixed issues (since Genome 4.2.5)

The following issues have been fixed in Genome 4.2.6:

·    1554: Support for VS2012 RC

Fixed issues (since Genome 4.2.6)

The following issues have been fixed in Genome 4.2.7:

·    1557: Support for VS2012 RTM

·    1555: Compatibility issue in VS2010 integration after installing VS2012 RC

Fixed issues (since Genome 4.2.7)

The following issues have been fixed in Genome 4.2.8:

·    1558: Add IBeforeRollbackCallback and IAfterRollbackCallback interfaces (analog to IBeforeCommitCallback and IAfterCommitCallback)

·    1559: Accessing Id property of a new, autoinc object throws: (#GEN0102) Identity must be qualified in order to be retrieved from the database

·    1561: Exception during TechTalk.Genome.DataAdapter.DatabaseProvider.GetUnderlyingType(Type type)

·    1556: Possibility to influence namespaces of generated proxy classes: <CodeGeneratedProxySettings prefix="mynamespace." /> (See <CodeGeneratedProxySettings> element in the documentation for more details.)

Fixed issues (since Genome 4.2.8)

The following issues have been fixed in Genome 4.2.9:

·    1564: Support for VS2013

·    1565: Support for compiling Genome DataDomain Schema projects to .NET 4.5 and .NET 4.5.1 platforms.

·    1562: KeyNotFoundException is thrown during rollback

·    1563: GEN2109 exception is thrown when transforming collection of a new parent

·    1566: Extend helper methods in StateTransferServices class for managing low-level state operations

Fixed issues (since Genome 4.2.9)

VS2015 support has been added with the following limitations:

·    Tools version of all projects have to be set to 12.0 (from the default 14.0 if created in VS2015)

·    Genome Messaging Extension project creates DTO and transformation projects as portable libraries or with wrong target framework setting. Workaround: create Dto and transformation projects as class libraries first, and select the existing projects in the wizard.

The following issues have been fixed in Genome 4.2.10:

·    1567: StateOptimisticLock VersionEquals might throw IndexOutOfRangeException

·    1568: NullReference exception when mapping stored procedures to a base class of shared inheritance type hierarchy

·    1569: Support .NET 4.5.2

·    1570: Support .NET 4.6

·    1571: Support PostgreSql database with DataDirect provider

·    1572: Support VS2015

·    1573: Include MsBuild targets and tasks in the Bin folder of installation to support referencing all Genome artifacts from a single folder

·    1574: GMX: FileNotFoundException / DirectoryNotFoundException when compiling using Genome targets

Fixed issues (since Genome 4.2.10)

The following issues have been fixed in Genome 4.2.11:

·    1611: Support .NET 4.6.1 and 4.6.2

·    1612: Improve dispose behaviour of commands

·    1613: In VS2015 Genome Messaging Extension project creates DTO and transformation projects as portable libraries or with wrong target framework setting

·    1614: VS2015 does not load GMX messaging project if no VS2013 installed

·    1615: Sqlite: incorrect query generation in case of multiple unions

·    1616: Sqlite: incorrect query generated for union of ranged queries

·    1617: Sqlite: wrong mapping of Nullable<DateTime>.Month

·    1618: Sqlite: wrong String.Length mapping

·    1619: Sqlite: Guid.ToString mapping to mimic .NET guid format, NewGuid mapping with randomblob

·    1620: Sqlite: extend drop statement with if exists clause