This release of DevForce 2010 includes a large number of enhancements and bug fixes.
DevForce 2010 version 6.0.8 now provides the ability to construct completely dynamic queries. See F1606 for more details.
Breaking changes
- CompositionHost.Instance.AddCatalog was removed. This method had been available as an adjunct to MEF initialization. If you were using this method, you can instead use CompositionHost.Instance.Catalog.Catalogs.Add. If you are using the new Silverlight on-demand content download available with this release, you will use one of the CompositionHost.Add overloads. See F1589 for more information.
- The PropertySortSelector no longer implements IEnumerable<PropertySortSelector>. In order to get the list of „chained‟ selectors within a PropertySortSelector use the new
IEnumerable<PropertySortSelector> GetChainedSelectors() method instead.
Defect repairs
- Silverlight: Loosened the rules for placement of models and links within desktop and Silverlight assemblies. You can now have: 1) multiple EDMX in a single desktop project with links in different Silverlight assemblies, and 2) a single Silverlight project holding links to entity models in multiple desktop assemblies. [B1606]
- The failureType parameter of the EntityServerInterceptor.OnError method was not always getting set properly. [B1652]
- Fixed a composition issue where the NullLoginManager could be used as the IEntityLoginManager even when a better match was available. [B1659]
- The EntityServerSaveInterceptor.OnError method was not receiving concurrency exceptions. [B1660]
- EntityAspect.RejectChanges was not clearing the EntityAspect.ValidationErrors collection. [B1662]
- INotifyDataErrorInfo.ErrorsChanged event was not getting fired after an EntityAspect.Clear method call. [B1663]
- Silverlight ObjectDataSource – Fix a NullReferenceException which occurred when paging was off and filters were not in use. Improved error messages. Allow filter changes when the query is not an EntityQuery and/or paging is off. [B1664]
- Many to many relations that were defined between detached entities were getting lost when the entities later got attached to an EntityManager. [B1666]
- Silverlight EntityQueryPagedCollectionView: Do not set PageIndex to -1 at initialization. Improved error handling. [B1668]
- Exclude interfaces from known type lookup. [B1669]
- Allow AspNetAuthenticatingLoginManager, and sub-types, to be used in 2-tier applications. [B1670]
- Fixed an issue where a Silverlight shortcut to the generated code of a model could be duplicated in multiple projects. [B1672]
- Allow store-generated ID to be in any column of a multi-column Primary Key. [B1673]
- Saving multiple new entities containing DateTimeOffset fields was failing. [B1674]
- Allow DataSourceKeyName to contain underscores. Underscores are used within DevForce to append a data source extension, and inclusion in the base key name caused an unhandled exception. [B1678]
- Support Contains query with List<byte> or List<decimal>, in addition to other numeric types already supported. [B1680]
- Intellisense and Help Reference information are now available for the EdmKey. [B1681]
- The EntityManager.RefetchEntities call would fail with a stack overflow when called with very large lists of entities. RefetchEntities calls are now batched so that even very large lists of entities can be handled. This does not change the API in any way but the default batch size can be controlled via a setting on the EntityManager. See F1607. [B1684]
- Silverlight Business Application templates – The revised templates contain a fix for a multi-threading problem causing intermittent errors related to verifier resources. [B1686]
- Silverlight: Fixed an issue with INotifyDataErrorInfo showing duplicate messages when adding a free form VerifierResult constructed with property names to EntityAspect.ValidationErrors collection. [B1687]
- Don‟t issue warning message for a remote service method with no return value. [B1688]
- Allow for the same short type name, for example “Customer”, in different entity models within an assembly. Improved error messages for metadata errors (including the dreaded “… must inherit from Entity and does not”). [B1689]
- Fixed a composition issue with how class and interface types get discovered. [B1696]
New and improved product features
- Added the EntityServerErrorInterceptor class to provide server-side interception and filtering of exceptions before sending to the client. Sub-type this class to override default processing. With a custom interceptor you can include centralized logging of exceptions, and disguise the exceptions sent to the client for security purposes. See the DevForce Resource Center for more information. [F1565]
- A Tag property was added to the SaveOptions class. Setting this property on the client to any 'WCF serializable' value allows this value to be inspected during the execution of any EntityServerSaveInterceptor, via the SaveOptions property, and can be used to mediate the save operation. Note that the Tag property on the QueryStrategy performs the same service within an EntityServerQueryInterceptor. An associated SaveOptions.WithTag method has also been added and may be used as follows [F1581]:
var saveResult = myEntityManager.SaveChanges(myEntityManager.DefaultSaveOptions.WithTag("my custom information")); - Silverlight: Support multi-XAP Silverlight applications with models in separate XAPs. DevForce now supports on-demand loading of entity models. See the DevForce Resource Center for a complete description and sample code. [F1589]
- The PredicateDescription class now supports nested properties. This means that you can now create predicateDescriptions such as [F1592]:
var pd = new PredicateDescription(typeof(Product), "Supplier.CompanyName", FilterOperator.StartsWith, "B");
var query = myEntityManager.Products.Where(pd); - Added support to allow entity metadata classes to participate in code generation. Support for the .NET MetadataTypeAttribute has been supported within DevForce since DF2010 was first released. However, as this attribute was originally designed by Microsoft, it was only intended to be used at design time to support code generation. This means that virtually none of the .NET base class libraries support any extended metadata at runtime. DevForce did offer this runtime support but it could only be provided to DevForce‟s own classes.
As of this release, we now automatically apply any Metadata markup directly to our generated code. This process occurs whenever an EDMX file is modified or when the custom tool associated with the generated code is executed manually. In other words, you will need to regenerate your model if you have used the [MetadataType] attribute in your existing code. This is required in order for your existing metadata markup to be picked up and regenerated into your domain model. Metadata markup for any given attribute on a per property basis will suppress whatever attribute DevForce‟s code generation would have provided. In the case of metadata markup that adds either .NET Validation or DevForce Verification attributes, this markup will replace all of Devforce‟s default generation of Validation or Verification attributes for that property. The idea here being that validation should either come from the metadata markup or from EDMX metadata but not both for the same property.
Within the EDMX designer, you can also suppress the generation of any attribute via the 'AttributesToSuppress' property. As of this release an additional 'Metadata' item now appears in this list, and can be used to tell the DevForce code generator to ignore any metadata attributes for the selected property. [F1599] - Silverlight: Enable application library caching of DevForce Silverlight assemblies. When the “Reduce XAP size by using application library caching” checkbox is selected on the Visual Studio property page of a Silverlight application, the referenced DevForce assemblies will be packaged separately as “zip” files. Library caching can improve startup performance of an application, and is also useful in applications supporting on-demand download of assemblies. See the DevForce Resource Center for more information. [F1601]
- A RefetchEntitiesAsync overload that takes an EntityState has been added. This was to provide parity with the synchronous API. [F1603]
- The PropertySortSelector now supports nested properties. This means that you can now create propertySelectors such as [F1605]:
var ps = new PropertySortSelector(typeof(Product), "Category.Name", ListSortDirection.Descending);
var query = _em1.Products.OrderBySelector(ps); - New extension methods that take a loosely typed IQueryable or IEntityQuery (as opposed to IQueryable<T> or IEntityQuery<T>) have been added to support additional dynamic query capabilities. [F1606]
IQueryable IQueryable.Where( IPredicateDescription);
IEntityQuery IEntityQuery.Where(IPredicateDescription)
IQueryable IQueryable.OrderBySelector(IPropertySortSelector);
IEntityQuery IEntityQuery.OrderBySelector(IPropertySortSelector)
This now allows for the construction of completely dynamic queries such as the following:
var entityType = typeof(Product);
var baseQuery = EntityQuery.Create(entityType);
var pd1 = new PredicateDescription(entityType, "UnitPrice", FilterOperator.IsGreaterThanOrEqualTo, 24);
var pd2 = new PredicateDescription(entityType, "Discontinued", FilterOperator.IsEqualTo, true);
var pd3 = new PredicateDescription(entityType, "Category.Name", FilterOperator.StartsWith, "P");
var pd = pd1.And(pd2).And(pd3);
var ps1 = new PropertySortSelector(entityType, "Category.Name");
var ps2 = new PropertySortSelector(entityType, "ProductName");
var ps = ps1.ThenBy(ps2);
var query = baseQuery.Where(pd).OrderBySelector(ps);
var results = myEntityManager.ExecuteQuery(query); - Added a new EntityManager.Options property that returns an instance of a new EntityManagerOptions class. At present this class contains a single property RefetchEntitiesBatchSize, that can be set to control the number of entities being queried with each batch that is submitted during a RefetchEntities call. Batching is necessary to avoid excessively large queries from being sent to the server in a single call. By default, this batch size is set to 200 and will not need to be changed in most cases. [F1607]