The official source of information on Managed Providers, DataSet & Entity Framework from Microsoft
For the release of SP1 Beta, several breaking changes were made to the Entity Framework. Below is a description of these changes and a mitigation for resolving the breaking change against previous releases.
Schema Changes( covers CSDL, SSDL and ProviderManifest Xml formats)
1. Attribute name for Default changed to Default values
Beta 3 Schema
<Property Name="tempval" Type="Int32" Default="12" />
SP1 Beta Schema
<Property Name="tempval" Type="Int32" DefaultValue="12" />
CSDL, SSDL and provider manifest schemas which used Defaults.
Either regenerate the schema files using the tools or change the files manually based on the information above.
2. PreserveSeconds facet has been removed
SSDL schemas which used PreserveSeconds facet.
There is no mitigation. We were not really using this facet and so we decided to remove it.
3. DateTimeKind facet has been removed
CSDL and SSDL schemas which used DateTimeKind facet.
4. In SSDL schema, ProviderManifestToken values for Sql Provider changed and there is a new required attribute called “Provider”.
All SSDL schemas that go against Sql Server Database.
Beta 3 Schema Fragment
<Schema Namespace="SchemaNS" ProviderManifestToken="09.00" xmlns="..">
<Schema Namespace="SchemaNS" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns="..">
Object Services Changes
1. Removing StructuralObject.SetValidValue methods
The following SetValidValue methods on the StructuralObject class were removed:protected internal static decimal SetValidValue(decimal value, int precision, int scale)
protected internal static Nullable<decimal>
SetValidValue(Nullable<decimal> value, int precision, int scale)protected internal static string
SetValidValue(string value, bool isNullable, int maximumLength)protected internal static Byte
SetValidValue(Byte value, bool isNullable, int maximumLength)protected internal static Nullable<DateTime>
SetValidValue(Nullable<DateTime> value, DateTimeKind kind)protected internal static DateTime
SetValidValue(DateTime value, DateTimeKind kind)
You can re-run code generation to get files without these method calls in place.
2. Renaming ObjectContext.QueryTimeout to CommandTimeout
Beta 3 Code
ObjectContext context = new ObjectContext(“connectionString”);
context.QueryTimeout = 30;
SP1 Beta Code
context.CommandTimeout = 30;
Rename the property.
3. Attempt to access connection object of ObjectContext after Dispose is called results in ObjectDisposedException being thrown.
The “disposed” ObjectContext can still be used as long as the caller does not directly or indirectly invoke an operation that requires a connection. A new ObjectContext will need to be created if access to the underlying store through an ObjectContext is required.
4. IRelatedEnd.Add allows repeated calls with the same parameter instance
IRelatedEnd.Add, EntityCollection.Add, and EntityReference.Value will no longer throw an exception if the same instance is added to the collection or reference more than once.
Order o = Order.CreateOrder(1);
// This line will throw
Order o = Orders.CreateOrder(1);customer.Orders.Add(o);// This line will NOT throwcustomer.Orders.Add(o);
//-- To get the original behavior:
Order o = Orders.CreateOrder(1);customer.Orders.Add(o);if(customer.Orders.Contains(o))
throw new InvalidOperationException(...);
To throw an exception in this case, you can decorate the call to Add or the Value setter to check if the collection or reference already contains the value you are adding.
5. IRelatedEnd.Remove and EntityCollection.Remove returns true or false rather than throwing an exception
The Remove API of EntityCollection and RelatedEnd has changed to return true if the item was successfully removed from the related end or collection, and false if the item could not be found for the remove. This more closely matches the .NET collection remove functionality.
// could not find the item
To get an exception, check the return value of Remove and throw an appropriate Exception.
1. InformationSchema Conceptual model used for Tools changed
SchemaInformation.Tables as t
t.Columns as c
, CASE WHEN pk.IsPrimaryKey IS NULL THEN false ELSE pk.IsPrimaryKey END as IsPrimaryKey
, c.Id as ColumnId
, c.Name as ColumnName
, c.ColumnType.TypeName as TypeName
, c.ColumnType.MaxLength as MaxLength
, c.ColumnType.Precision as Precision
, c.ColumnType.DateTimePrecision as DateTimePrecision
, c.ColumnType.Scale as Scale
SchemaInformation.Tables as t
t.Columns as c ) as t
LEFT OUTER JOIN (
true as IsPrimaryKey
OfType(SchemaInformation.TableConstraints, Store.PrimaryKeyConstraint) as pk
CROSS APPLY pk.Columns as pkc) as pk
ON t.ColumnId = pk.Id
All the same infomation is available, but in a different shape so most queries will need to be re written
1. StoreItemCollection public constructor changes
You are no longer able to create an "Empty" StoreItemCollection, or a StoreItemCollection with only PrimitiveTypes in it. If you need the Store PrimitiveTypes, you will need to find them in the DbProviderManifest.
StoreItemCollection itemCollection = new StoreItemCollection(connection, file1, file2);
StoreItemCollection itemCollection = new StoreItemCollection(file1, file2);
Remove the DbConnection or DbProviderFactory from your call to the constructor of StoreItemCollection
2. Changed the hash computation used in pre-generated views to ignore the facets( except for Nullable facet).
View Generation was changed to not take these facets into account so these values are not used in the hash generation.
Please regenerate the generated views source file using the “EdmGen /mode:ViewGeneration …”.