Quino v1.13.0: Schema migration, remoting, services and web apps
The summary below describes major new features, items of note and breaking changes in Quino. The full list of issues is also available for those with access to the Encodo issue tracker.
Highlights
Data & Schema
- Applications can now choose a base class for generated ORM objects. (QNO-3107)
- Data driver: made various bug fixes and improvements. (QNO-4538, QNO-4554, QNO-4551)
- Improved schema migration for fields and constraint-violation messages under SQL Server. (QNO-4490, QNO-4111, QNO-4582)
- Improved the console migrator and APIs, input queries and exit-code handling for console applications in general. Also changed the default command from [R]efresh to [S]how differences. (QNO-4649, QNO-4646, QNO-4648, QNO-4650, QNO-4651, QNO-4615, QNO-4645, QNO-4616)
Remoting & services
- Fixed several issues in the remoting driver (client and server parts). (QNO-4626, QNO-4630, QNO-4631, QNO-4388, QNO-4575, QNO-4629, QNO-4573, QNO-4625, QNO-4633, QNO-4575)
- Added a runner for Windows services that allows debugging and shows logging output for applications that use the
CoreServiceBase
, which extends the standard .NETServiceBase
. The runner is available in theEncodo.Service
assembly.
Web
- Improved default and custom authentication in web applications and the remoting server. Also improved support for authorization for remote-method routes as well as MVC controllers.
- Improved configuration, error-handling and stability of the
HttpApplicationBase
, especially in situations where the application fails to start. Error-page handling was also improved, including handling forWindows Event Log
errors. - Improved appearance of the web-based schema migrator. (QNO-4559, QNO-4561, QNO-4563, QNO-4548, QNO-4487, QNO-4486, QNO-4488)
Winform
- Data-provider statistics: improved the WinForm-based statistics form. (QNO-4231, QNO-4545, QNO-4546)
- Standard forms: updated the standard WinForm about window and splash screen to use Encodo web-site CI. (QNO-4529)
System & Tools
- Removed the dependency on the SmartWeakEvents library from Quino. (QNO-4645); the Quino and Encodo assemblies now no longer have any external dependencies.
- Image handling: the Encodo and Quino libraries now use the Windows Imaging Components instead of System.Drawing. (QNO-4536)
- Window 8.1: fixed culture-handling for en-US and de-CH that is broken in Windows 8.1. (QNO-4534, QNO-4553)
- R# annotations have been added to the Encodo assembly. Tell R# to look in the
Encodo.Core
namespace to use annotations likeNotNull
andCanBeNull
with parameters and results. (QNO-4508) Generated code now includes a property that returns a
ValueListObject
for eachenum
property in the metadata. For example, for a property namedState
of typeCoreState
, the generated code includes the former properties for theenum
and the foreign key backing it, but now also includes theValueListObject
property. This new property provides easy access to the captions.public CoreState State { … } public ValueListObject StateObject { … } public int? CoreStateIdId { … }
Improved the nant fix command in the default build tools to fix the assembly name as well. The build tools are available in bin/tools/build. See the
src/demo/Demo.build
file for an example on how to use the Nant build scripts for your own solutions. To change the company name used by the “fix” command, for example, add the following task override:<target name="fix.before"> <call target="fix.before.base"/> <property name="InfoCompanyName" value="Foobar Corporation"/> </target>
- Fixed the implementation of
IntegrateRemotableMethods
to avoid a race condition with remote methods. Also improved the stability of theDataProvider
statistics. (QNO-4599)
Breaking changes
- The generic argument
TRight
has been removed from all classes and interfaces in theEncodo.Security.*
namespace. In order to fix this code, just remove theint
generic parameter wherever it was used. For example, where before you used the interfaceIUser<int>
, you should now useIUser
(QNO-4576). - The overridable method
MetaAccessControl.DoGetAccessChecker()
has been renamed toMetaAccessControl.GetAccessChecker()
. - Renamed the
Encodo.ServiceLocator.SimpleInjector.dll
toEncodo.Services.SimpleInjector.dll
andQuino.ServiceLocator.SimpleInjector.dll
toQuino.Services.SimpleInjector.dll
Also changed the namespaceQuino.ServiceLocator
toEncodo.Quino.Services
. - Renamed
HttpApplicationBase.StartMetaApplication()
toCreateAndStartUpApplication()
. - Classes may no longer contain properties with names that conflict with properties of
IMetaReadable
(e.g.Deleted
,Persisted
). The model will no longer validate until the properties have been renamed and the code regenerated. (QNO-4185) - Removed
StandardIntRights
with integer constants and replaced it withStandardRights
with string constants. - The
IAccessControl.Check()
and other related methods now accept a sequence of string rights rather than integers. IMetaConfiguration.ConfigureSession()
has been deprecated. The method will still be called but may have undesired side-effects, depending on why it was overridden. The common use was to initialize a customAccessControl
for the session. Continuing to do so may overwrite the current user set by the default Winform startup. Instead, applications should use theIDataSessionAccessControlFactory
andIDataSessionFactory
to customize the data sessions and access controls returned for an application. In order to attach an access control, take care to only set your custom access control for sessions that correspond to your application model.[1]internal class JobVortexDataSessionAccessControlFactory : DataSessionAccessControlFactory { public override IAccessControl CreateAccessControl(IDataSession session) { if (session.Application.Model.MetaId == JobVortexModelGenerator.ModelGuid) { return new JobVortexAccessControl(session); } return base.CreateAccessControl(session); } }
The default length of the
UserModule.User.PasswordHash
property has been increased from 100 characters to 1000. This default is more sensible for implementations that use much longer validations tokens instead of passwords. To avoid the schema migration, revert the change by setting the property default length back to 0 in your application model, after importing the security module, as shown below.var securityModule = Builder.Include<SecurityModuleGenerator>(); securityModule.Elements.Classes.User.Properties[ Encodo.Quino.Models.Security.Classes.SecurityUser.Fields.PasswordHash ].MaximumSize = 100;
Application.Credentials
has been removed. To fix references, retrieve theIUserCredentialsManager
from the service locator. For example, the following code returns the current user:Session.Application.Configuration.ServiceLocator.GetInstance<IUserCredentialsManager>().Current
If your application uses the
WinformMetaConfigurationTools.IntegrateWinformPackages()
orWinformDxMetaConfigurationTools.IntegrateWinformDxPackages()
, then theIDataSession.AccessControl.CurrentUser
will continue to be set correctly. If not, add theSingleUserApplicationConfigurationPackage
to your application’s configuration. The user in the remoting server will be set up correctly. Add theWebApplicationConfigurationPackage
to web applications in order to ensure that the current user is set up correctly for each request. (QNO-4596)IDataSession.SyncRoot
has been removed as it was no longer needed or used in Quino itself. Sessions should not be used in multiple threads, so there is no need for aSyncRoot
. Code that uses it should be reworked to use a separate session for each thread.- Moved
IMetaApplication.CreateSession()
to an extension method. AddEncodo.Quino.App
to the using clauses to fix any compile errors. - Removed
IMetaApplication.DataProvider
; useIMetaApplication.Configuration.DataProvider
instead. (QNO-4604) - The schema migration API has been completely overhauled.
ISchemaChange
and descendents has been completely removed.ISchemaAction
is no longer part of the external API, although it is still used internally. TheISchemaChangeFactory
has been renamed toISchemaCommandFactory
and, instead of creating change objects, which are then applied directly, returnsISchemaCommand
objects, which can be either executed or transformed in some other way.IMigrateToolkit.GetActionFor()
has also been replace withCreateCommands()
, which mirrors the rest of the API by returning a sequence of commands to address a givenISchemaDifference
. This release still has some commands that cannot be transformed to pure SQL, but the goal is to be able to generate pure SQL for a schema migration. (QNO-993, QNO-4579, QNO-4581, 4588, 4591, QNO-4594) IMigrateSchemaAspect.Apply()
has been removed. All aspects will have to be updated to implementGetCommands()
instead, or to use one of the available base classes, likeUpdateDataAspectBase
orConvertPropertyTypeSchemaAspect
. The following example shows how to use theUpdateDataAspectBase
to customize migration for a renamed property.internal class ArchivedMigrationAspect : UpdateDataAspectBase { public ArchivedMigrationAspect() : base("ArchivedMigrationAspect", DifferenceType.RenamedProperty, ChangePhase.Instead) { } protected override void UpdateData(IMigrateContext context, ISchemaDifference difference) { using (var session = context.CreateSession(difference)) { session.ChangeAndSaveAll<Project>(UpdateArchivedFlag); } } private void UpdateArchivedFlag(Project obj) { obj.Archived = !obj.Archived; } }
The base aspects should cover most needs; if your functionality is completely customized, you can easily pass your previous implementation of
Apply()
to aDelegateSchemaCommand
and return that from your implementation ofGetCommands()
. See the implementation ofUpdateDataAspectBase
for more examples. (QNO-4580)MetaObjectIdEqualityComparer<T>
can no longer be constructed directly. Instead, useMetaObjectIdEqualityComparer<Project>.Default
.- Renamed
MetaClipboardControlDx.UpdateColorSkinaware()
toMetaClipboardControlDx.UpdateSkinAwareColors()
. IMetaUnique.LogicalParent
has been moved toIMetaBase
. SinceIMetaUnique
inherits fromIMetaBase
, it is unlikely that code is affected (unless reflection or some other direct means was used to reference the property). (QNO-4586)IUntypedMessage
has been removed; theAssociatedObject
formerly found there has been moved toIMessage
.ITypedMessage.AssociatedObject
has been renamed toITypedMessage.TypedAssociatedObject
. (QNO-4647)- Renamed
MetaObjectTools
toMetaReadableTools
. - Redefined the protected methods
GenericObject.GetAsGuid()
andGenericObject.GetAsGuidDefault
as extension methods inMetaWritableTools
. IMetaFeedback.CreateGlobalContext()
has been removed. Instead theIGlobalContext
is created using the service locator.