The Client is retrieving the metadata from a service. That call is succeeding.
But the call entityManager.CreateEntity(); is failing.
The error is:
"There are no KeyProperties yet defined on EntityType: 'Customer:#MyCommerceServer.Models'. Please insure that the metadata for this type is complete either by calling FetchMetadata or by explicitly updating the KeyProperties before creating an EntityKey for this type."}
But the following passes with an exception says the customer is detached.
var customerType = entityManager.MetadataStore.GetEntityType(typeof(Customer));
var customer = customerType .CreateEntity();
Here is my set up. The Customer entity has a key named Id. The Customer entity on the client also has the same key. The entities on client and server exist in the same namespace.
Is there any setup I have to add to have the Customer entity KeyProperties? I see the same problem in the ToDo sample project also.
******** Update on 8/12/2014
On the server:
namespace MyCommerceServer.Models
{
public class Customer
{
public int Id { get; set; }
}
}
On the client:
namespace MyCommerceServer.Models
{
public class Customer : BaseEntity
{
public int Id
{
get { return GetValue<int>(); }
set { SetValue(value); }
}
}
}