Hi
I'm trying to create a new Entity Datat Model Generated from an exiting database, and I'm having some trouble with datatypes on parametrs not matching the the datatypes on some columns on the tabel.
/*
Server version : 5.0.51b-community-nt
*/
/*Table structure for table `defaultmenuitems` */
CREATE TABLE `defaultmenuitems` (
`MenuID` int(11) NOT NULL,
`ItemID` int(11) NOT NULL,
`MenuText` varchar(50) default NULL,
`WebPage` varchar(50) default NULL,
`ParentID` int(11) default NULL,
`ShowIt` tinyint(1) default NULL,
`Auth` tinyint(4) default NULL,
PRIMARY KEY (`MenuID`,`ItemID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
The two coluoms with the problems is ShowIt and Auth. Both are "translated" into type SByte when the data model is created.
I have 3 stored procedures (CRUD):
CREATE PROCEDURE `defaultmenuitemsAdd`( `?menuID` int, `?menuText` varchar(50), `?webPage` varchar(50), `?parentID` int, `?showIt` tinyint(1), `?auth` tinyint )
BEGIN
INSERT INTO defaultmenuitems (
MenuID,
MenuText,
WebPage,
ParentID,
ShowIt,
Auth
) VALUES (
`?MenuID`,
`?MenuText`,
`?WebPage`,
`?ParentID`,
`?ShowIt`,
`?Auth`
);
select LAST_INSERT_ID();
CREATE PROCEDURE `defaultmenuitemsUpdate`( `?menuID` int, `?itemID` int, `?menuText` varchar(50), `?webPage` varchar(50), `?parentID` int, `?showIt` tinyint(1), `?auth` tinyint )
UPDATE defaultmenuitems SET
MenuID = `?MenuID`,
MenuText = `?MenuText`,
WebPage = `?WebPage`,
ParentID = `?ParentID`,
ShowIt = `?ShowIt`,
Auth = `?Auth`
WHERE
ItemID = `?ItemID`;
CREATE PROCEDURE `defaultmenuitemsDelete`( `?itemID` int )
DELETE FROM defaultmenuitems
WHERE
ItemID = `?ItemID`;
Below is the generated Model1.edmx (in XML)
The funny thing is the both the p_auth and p_showit paramters is of tinyint type in the function import, but in the table field mapping they have the type of SByte. When I try to do the Stored Procedure Mapping for the CRUD functions I get a build error saying:
Error 2042: Parameter Mapping specified is not valid. The type 'Edm.SByte' of member 'Auth' in type 'tvsyddbModel.defaultmenuitems' is not compatible with 'CoreLab.MySql.tinyint' of parameter 'p_auth' in function 'tvsyddbModel.Store.defaultmenuitemsAdd'.
Error 2042: Parameter Mapping specified is not valid. The type 'Edm.SByte' of member 'Auth' in type 'tvsyddbModel.defaultmenuitems' is not compatible with 'CoreLab.MySql.tinyint' of parameter 'p_auth' in function 'tvsyddbModel.Store.defaultmenuitemsUpdate'.
Error 2042: Parameter Mapping specified is not valid. The type 'Edm.SByte' of member 'ShowIt' in type 'tvsyddbModel.defaultmenuitems' is not compatible with 'CoreLab.MySql.tinyint' of parameter 'p_showit' in function 'tvsyddbModel.Store.defaultmenuitemsAdd'.
Error 2042: Parameter Mapping specified is not valid. The type 'Edm.SByte' of member 'ShowIt' in type 'tvsyddbModel.defaultmenuitems' is not compatible with 'CoreLab.MySql.tinyint' of parameter 'p_showit' in function 'tvsyddbModel.Store.defaultmenuitemsUpdate'.
I wonder why the Data Model Generator is able to map the field type correctly, when mapping the table, but not when the Function paramters is mapped?
objecta
Type confusion in Entity Framework
The new build of MyDirect .NET version 4.85.36 is available!
Please visit http://devart.com/forums/viewtopic.php?t=12983
Please visit http://devart.com/forums/viewtopic.php?t=12983