I was banging through some quick and dirty sample applications today, in preparation for a talk on LINQ tonight. One of my old LINQ to SQL demos shows how to use the external xml mapping file. I also
blogged about this before. Today, I kept getting the following error whenever I would run with an external xml mapping file:
The type 'Order' is not an entity.
I was using the following command line to generate the xml mapping file:
SqlMetal /server:(local) /database:Northwind /map:Northwind.xml /code:Northwind.cs /pluralize
Looking at the resulting xml file, I finally noticed this section:
<Table Name="Orders">
<Type Name=".Order">
Notice the leading dot before the type name attribute. That's the problem. So I went back and added the /namespace switch to the sqlMetal command line, and now all is well with the world again. Granted, this problem is the result of me doing demo work, and not production work, but it's still a little bit irritating. Then again, I'm still running the May 2006 CTP on VS2005, so for all I know, MS has already fixed all of this with a subsequent release of a build in Orcas.