Incorrect syntax near 'nvarchar'. Must declare the scalar variable "@".


tried to use the inheritance mapping. I get an error for each when a try to create a new FACTORY. I use the example from documentation with the entity map looking like
<Entity type="Domain:Company" table="Company" discriminator-field="Type"
<Id field="CompanyId">
<Generator name="guid" />
<Attribute name="Name" field="Name" db-type="String"/>
<Attribute name="SiretNb" field="SiretNb" db-type="Int32"/>
<Entity type="Domain:Factory" table="Company"
discriminator-value="Factory" >
<Id field="CompanyId">
<Generator name="guid" />
<Attribute name="City" field=" City " db-type="String"/>
I checked the query which looks like:
INSERT INTO [Company] ([CompanyId] , [ City ] , [Name] , [SiretNb] ) VALUES ( @EntityId , @ City , @Name , @SiretNb )
The parameters inside look fine and have the correct values. It happens only when I try to save values for derived class. Tried the same thing for the company class and works fine.
Thank you Cristian
btw I like your work
Closed Nov 16, 2009 at 10:25 AM by sebastienros
The issue is in the documentation, there is a typo issue in the mapping. The field for City should not contain a space.


cristianrep wrote Nov 9, 2009 at 6:35 PM

Never mind. I figured it out.Seems then declaration <Attribute name="City" field=" City " db-type="String"/> has in [field] tag " CITY " with some spaces, as soon as they are removed then is works fine.

wrote Nov 16, 2009 at 10:25 AM

wrote Feb 13, 2013 at 8:39 PM

wrote May 16, 2013 at 2:37 AM