Wednesday, 21 May 2014

Error: Precision facet isn't allowed for properties of type string

Using Entity Framework 5, database first, and creating a WCF Data Service for the entities, gave this error: "precision facet isn't allowed for properties of type string".

Steps to get this error

  1. In SQL Server, create a table with a field with a datatype of time(7).
  2. In Visual Studio 2012, create a project of type ASP.Net Empty Web Application.
  3. In this project, add a new item of type ADO.Net Entity Data Model.
  4. For the EDM, connect to the database and use the table that has the time field to create a data model.
  5. In this same project, add an item of type WCF Data Service.
  6. Use the Entity Data Model just created.
  7. Build.
  8. Create a new project such as a Windows Forms Application.
  9. Add a Service Reference to the WCF Data Service created earlier.
  10. This is the point at which you get the error.


Visual Studio 2012 Update 1
Entity Framework 5
C# .Net 4.0
SQL Server 2008 R2


For anybody else who hits this error: there was a database field with a data type of time(7); removing this field worked around the error.

More Information

No comments:

Post a Comment