This release of DevForce 2010 includes a Community Technology Preview (CTP) of our support for Code First.
After upgrading to this release, you must regenerate your code from the EDMX.
Do this by re-saving the EDMX or by right clicking the .EDMX.TT file within Visual Studio 2010 and selecting Run Custom Tool.
Code First CTP
- Future DevForce developers will be able to write their Entity Framework-based models in "Code First" style. This 6.1.2 release includes a Community Technology Preview (CTP) of our support for Code First. Note that this feature is a CTP: the workflow, interfaces, and behavior may be radically different in the final release. Please look at it and give us your feedback but don‟t use it in your production application.
Breaking changes
Please note that the following breaking changes only apply if you‟re overriding our DomainModelTemplate. These breaking changes are necessary for our preparation of Entity Framework Code First support.
- IdeaBlade.EntityModel.ForeignKeyAttribute has been removed.
- IdeaBlade.EntityModel.RelationPropertyAttribute has been removed.
- IdeaBlade.EntityModel.ConcurrencyStrategyAttribute has been added. This will be applied to a property when its ConcurrencyStrategy is not set to None.
- IdeaBlade.EntityModel.DataEntityProperty constructor now takes 1 more string parameter that specifies the name of the related navigation property name if the property is a foreign key. You need to specify null otherwise.
- Added a new function called WriteEdmFunctionOutParameterUpdate that you can override if you wish to customize your stored proc queries with OUT parameters.
- When overriding WriteEdmFunctionExecuteDefinition, remember that the class MethodDef now takes a new parameter called ParameterMode that defaults to null. If you have stored procedures with OUT parameters in your model, you have to supply this new ParameterMode.
- As we ship our DomainModelTemplate.cs with every DevForce install, you always have access to it if you‟d like to see the changes in more detail.
Defect repairs
- Entity relations on derived classes (entity classes inheriting from other entity classes) were not being correctly resolved when retrieving from the datasource and the related entities were already in the cache. Fixed. [D1799]
- The phrase "(internal)" was removed from the AssemblyCompany attribute on DevForce assemblies intended for distribution. [D1802]
- The EntityKeyQuery was not always producing correct results if some items were already in the cache. Fixed. [D1806]
- StoredProcQueries involving self referencing foreign key properties were setting these foreign key properties to null instead of the correct foreign key value. Fixed. [D1808]
- Adding a newly created unattached entity to a list navigation property could duplicate it. Fixed. [D1809]
- The PartsCatalog used during Composition will now correctly exclude *.config files. [D1810]
- PredicateDescription instances now support passing in a „null‟ value parameter even when comparing a non-nullable property. Previously this would fail. [D1814]
- Performing a Distinct() operation on a anonymous projection with a “CacheOnly” QueryStrategy would fail in Silverlight. Fixed. [D1815]
- The OriginalValues collection on ComplexType instances was not being reset properly after a SaveChanges call. Fixed. [D1816]
- Updating an existing entity's primary key will now throw an immediate exception with a description of the issue. Previously, these entities would simply not be savable. [D1817]
- Anonymous projections with a “CacheOnly” QueryStrategy would fail in Silverlight. Fixed. [D1818]
- FilterOperator.Any and FilterOperator.All now work with a CompositePredicateDescription. [D1820]
- The multi-BOS feature using serviceKeys now correctly supports different application names. [D1821]
- Entities removed from the EntityManager could become “reattached” to an EntityManager by modifying their foreign key properties to point to an existing entity in an EntityManager. Reattachment now only occurs during NavigationProperty reassignment. [D1824]
- PredicateDescriptions using "FilterOperator.InList" will no longer throw an ArgumentException when used with nullable properties. [D1827]
- Updating entities on both sides of a many to many relation with no payload could cause a duplicate relation entity to be created. Fixed. [D1828]
- Repairing a failed server-side property value validation would not clear the error from the entity's ValidationErrors collection. Fixed. [D1830]
- We now provide a better, more explanatory error message when the synchronous version of either a StoredProcQuery or a PassthruESQL query is called in Silverlight. [D1831]
- EntityFramework „EDMX‟ files with explicit „csdl‟ namespaces could cause the DevForce designer to break. (This could occur when using a third party XML editor to edit the EDMX). Fixed. [D1836]
- MetadataType lookup during code generation was not always discovering nested metadata classes. Fixed. [D1837]
- Building a CompositePredicateDescription takes increasingly longer with each predicate added, eventually leading to a timeout. Fixed. [D1842]
New and improved product features
- OUT parameters are now supported in stored procedure queries. DevForce code generation will generate any OUT parameters as 'ref' parameters in c#. (ByRef in VB). Generated code to access a stored proc with output parameters will now appear something like the following: [F1703]
public void GetCompanyInfo(System.Nullable<int> Id, ref string CompanyName, ref System.Nullable<int> RowVersion) - PredicateDescription instances can now be created where the 'value' parameter is another property on the object. For example: [F1729]
myEntityManager.Customers.Where(c => c.Phone == c.Fax);
Using PredicateDescription this becomes
var pd = new PredicateDescription(typeof(Customer), "Phone", FilterOperator.IsEqualTo, new ProjectionSelector("Fax"));
myEntityManager.Customers.Where(pd); - Code First CTP. [F1741]
- The EntityManager constructor that takes an existing EntityManager instance as a parameter: [F1744]
- public EntityManager(EntityManager entityManager, EntityManagerContext entityManagerContext = null)
has had its behavior extended so that any VerifierEngine associated with the 'passed in' EntityManager is treated as a thread local VerifierEngine and is only associated with the new EntityManager if it is created on the same thread as the 'passed in' EntityManager. Otherwise a new VerifierEngine is associated with the new EntityManager. (Note that any newly constructed VerifierEngine will automatically discover any applicable verifiers). This change was made because VerifierEngines, like EntityManager's are NOT thread safe, and unless special care was taken the same VerifierEngine previously would often get accessed by more than one thread. This is unlikely to be a breaking change because of the DevForce Verifier discovery mechanism but if it is, the previous behavior can be restored by assigning the 'passed in' EntityManager's VerifierEngine to the new EntityManager's VerifierEngine property. - PredicateDescription instances can now be created that compare string values for all comparison operators (>,>=, <, <= , ==). Note that this is not supported by standard .NET syntax i.e. [F1745]
myEntityManager.Customers.Where(c => c.CompanyName > “F”); INVALID .NET Syntax (Strings are not comparable via standard operators)
Must be rewritten as:
myEntityManager.Customers.Where(c => c.CompanyName.CompareTo(“F”) > 0);
Using PredicateDescription this is now possible and is expressed as:
var pd = new PredicateDescription(typeof(Customer), "CompanyName, FilterOperator.IsGreaterThan, “F”);
myEntityManager.Customers.Where(pd);