Getting error on add new “Table ‘conjero.tmpidentity_project_consultant_order’ doesn’t exist” on MySql CodeFirst with EF

In my project I am handling two type auto generated keys. Long and Guid. Previously long only i used in this project. Now added Guid also. I previously used this with out any with out any problem in MSSQL. I created one table via migration. It works fine. In the case of second table, I created model and table separately for a reason.  At this time I getting an error while am try to add something.

Table ‘conjero.tmpidentity_project_consultant_order’ doesn’t exist

I don’t have any idea about tmpidentity_. What it is ?

Search in google about tmpidentity and got one link, https://github.com/pdonald/mysql-connector-net/blob/master/Source/MySql.Data.Entity/MySqlMigrationSqlGenerator.cs

Here talking about some TRIGGER. So I checked previously created table and its trigger. there is trigger for handling auto generated guid. I Just copy paste that trigger and rename as per second table name.

My issue fixed!!

Following is the trigger:

CREATE DEFINER=`root`@`%` TRIGGER `conjero`.`project_consultant_order_BEFORE_INSERT` BEFORE INSERT ON `project_consultant_order` FOR EACH ROW
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmpIdentity_project_consultant_order;
		CREATE TEMPORARY TABLE tmpIdentity_project_consultant_order (guid CHAR(36))ENGINE=MEMORY;
		SET @var_Id = UUID();
		INSERT INTO tmpIdentity_project_consultant_order VALUES(@var_Id);
		SET new.Id = @var_Id;
END
Advertisements