This question is locked. New answers and comments are not allowed.
I'm sure i'm missing something pretty silly here but I keep getting the following error... please help.. Also, how do you map complex types?
This is against the northwind sample db..
System.MissingFieldException : There is no field with name 'CustomerID' backing 'Id' property in type 'MMG.Core.Testing.Integration.Northwind.Customer'. You need to either change the Field Naming rules of the mapping configuration object or call HasFieldName(string) with the name of the backing field.
Code:
public class CustomerOAMapping : MappingConfiguration<Customer>
{
public CustomerOAMapping()
{
MapType().ToTable("Customers");
HasProperty(p => p.Id).HasFieldName("CustomerID").IsIdentity().HasLength(5);
HasProperty(p => p.Name).HasFieldName("CompanyName").HasLength(40).IsNullable();
//contact complex
HasProperty(p => p.Contact.Name).HasFieldName("ContactName").HasLength(30);
HasProperty(p => p.Contact.Title).HasFieldName("ContactTitle").HasLength(30);
HasProperty(p => p.Contact.Phone).HasFieldName("Phone").HasLength(24);
HasProperty(p => p.Contact.Fax).HasFieldName("Fax").HasLength(24);
//address complex
HasProperty(p => p.Contact.Address.Street).HasFieldName("Address").HasLength(60);
HasProperty(p => p.Contact.Address.City).HasFieldName("City").HasLength(15);
HasProperty(p => p.Contact.Address.Region).HasFieldName("Region").HasLength(15);
HasProperty(p => p.Contact.Address.PostalCode).HasFieldName("PostalCode").HasLength(60);
HasProperty(p => p.Contact.Address.Country).HasFieldName("Country").HasLength(15);
}
}
}
This is against the northwind sample db..
System.MissingFieldException : There is no field with name 'CustomerID' backing 'Id' property in type 'MMG.Core.Testing.Integration.Northwind.Customer'. You need to either change the Field Naming rules of the mapping configuration object or call HasFieldName(string) with the name of the backing field.
Code:
public class CustomerOAMapping : MappingConfiguration<Customer>
{
public CustomerOAMapping()
{
MapType().ToTable("Customers");
HasProperty(p => p.Id).HasFieldName("CustomerID").IsIdentity().HasLength(5);
HasProperty(p => p.Name).HasFieldName("CompanyName").HasLength(40).IsNullable();
//contact complex
HasProperty(p => p.Contact.Name).HasFieldName("ContactName").HasLength(30);
HasProperty(p => p.Contact.Title).HasFieldName("ContactTitle").HasLength(30);
HasProperty(p => p.Contact.Phone).HasFieldName("Phone").HasLength(24);
HasProperty(p => p.Contact.Fax).HasFieldName("Fax").HasLength(24);
//address complex
HasProperty(p => p.Contact.Address.Street).HasFieldName("Address").HasLength(60);
HasProperty(p => p.Contact.Address.City).HasFieldName("City").HasLength(15);
HasProperty(p => p.Contact.Address.Region).HasFieldName("Region").HasLength(15);
HasProperty(p => p.Contact.Address.PostalCode).HasFieldName("PostalCode").HasLength(60);
HasProperty(p => p.Contact.Address.Country).HasFieldName("Country").HasLength(15);
}
}
}