我有一个使用 Entity framework 6和Mysql Database 的c#应用程序。我添加了这个存储过程:
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `ps_reservation`(IN id_compte varchar(128))
BEGIN
if id_compte is null then
SELECT
`ajtdev`.`ajt_demande`.`id` AS `id_demande`,
`ajtdev`.`ajt_demande`.`date_intervention` AS `date_intervention`,
`ajtdev`.`ajt_demande`.`from_time` AS `from_time`,
`ajtdev`.`ajt_demande`.`to_time` AS `to_time`,
`ajtdev`.`ajt_demande`.`id_begin_place` AS `id_from_place`,
`ajtdev`.`ajt_demande`.`id_end_place` AS `id_to_place`,
`ajtdev`.`ajt_demande`.`bot` AS `bot`,
`ajtdev`.`ajt_client`.`nom` AS `nom_client`,
`ajtdev`.`ajt_client`.`prenom` AS `prenom_client`,
`ajtdev`.`ajt_coordonne`.`tel` AS `tel_client`,
`ajtdev`.`ajt_statut_demande`.`libelle` AS `statut_demande`,
`ajtdev`.`ajt_vehicle`.`immarticulation` AS `immarticulation_vehicle`,
`ajtdev`.`ajt_vehicle`.`marque` AS `marque_vehicle`,
`ajtdev`.`ajt_collaborator`.`id` AS `id_chauffeur`,
`ajtdev`.`ajt_collaborator`.`Nom` AS `nom_chauffeur`,
`ajtdev`.`ajt_collaborator`.`Prenom` AS `prenom_chauffeur`,
`ajtdev`.`ajt_collaborator`.`id_user_fk` AS `id_user`
FROM
`ajtdev`.`ajt_demande` JOIN `ajtdev`.`ajt_statut_demande` ON (`ajtdev`.`ajt_demande`.`id_statut` = `ajtdev`.`ajt_statut_demande`.`id`)
JOIN `ajtdev`.`ajt_client` ON (`ajtdev`.`ajt_demande`.`id_client` = `ajtdev`.`ajt_client`.`id`)
JOIN `ajtdev`.`ajt_coordonne` ON (`ajtdev`.`ajt_client`.`id_coordonne` = `ajtdev`.`ajt_coordonne`.`id`)
JOIN `ajtdev`.`ajt_ass_veh_col` ON (`ajtdev`.`ajt_demande`.`id_ass_veh_col_fk` = `ajtdev`.`ajt_ass_veh_col`.`id`)
JOIN `ajtdev`.`ajt_vehicle` ON ( `ajtdev`.`ajt_ass_veh_col`.`veh_id_fk` = `ajtdev`.`ajt_vehicle`.`Id`)
JOIN `ajtdev`.`ajt_collaborator` ON (`ajtdev`.`ajt_ass_veh_col`.`col_id_fk` = `ajtdev`.`ajt_collaborator`.`Id`)
WHERE
ISNULL(`ajtdev`.`ajt_demande`.`deletion_date`)
and ISNULL(`ajtdev`.`ajt_collaborator`.`deletion_date`)
and ISNULL(`ajtdev`.`ajt_client`.`deletion_date`)
and ISNULL(`ajtdev`.`ajt_vehicle`.`deletion_date`);
else
SELECT
`ajtdev`.`ajt_demande`.`id` AS `id_demande`,
`ajtdev`.`ajt_demande`.`date_intervention` AS `date_intervention`,
`ajtdev`.`ajt_demande`.`from_time` AS `from_time`,
`ajtdev`.`ajt_demande`.`to_time` AS `to_time`,
`ajtdev`.`ajt_demande`.`id_begin_place` AS `id_from_place`,
`ajtdev`.`ajt_demande`.`id_end_place` AS `id_to_place`,
`ajtdev`.`ajt_demande`.`bot` AS `bot`,
`ajtdev`.`ajt_client`.`nom` AS `nom_client`,
`ajtdev`.`ajt_client`.`prenom` AS `prenom_client`,
`ajtdev`.`ajt_coordonne`.`tel` AS `tel_client`,
`ajtdev`.`ajt_statut_demande`.`libelle` AS `statut_demande`,
`ajtdev`.`ajt_vehicle`.`immarticulation` AS `immarticulation_vehicle`,
`ajtdev`.`ajt_vehicle`.`marque` AS `marque_vehicle`,
`ajtdev`.`ajt_collaborator`.`id` AS `id_chauffeur`,
`ajtdev`.`ajt_collaborator`.`Nom` AS `nom_chauffeur`,
`ajtdev`.`ajt_collaborator`.`Prenom` AS `prenom_chauffeur`,
`ajtdev`.`ajt_collaborator`.`id_user_fk` AS `id_user`
FROM
`ajtdev`.`ajt_demande` JOIN `ajtdev`.`ajt_statut_demande` ON (`ajtdev`.`ajt_demande`.`id_statut` = `ajtdev`.`ajt_statut_demande`.`id`)
JOIN `ajtdev`.`ajt_client` ON (`ajtdev`.`ajt_demande`.`id_client` = `ajtdev`.`ajt_client`.`id`)
JOIN `ajtdev`.`ajt_coordonne` ON (`ajtdev`.`ajt_client`.`id_coordonne` = `ajtdev`.`ajt_coordonne`.`id`)
JOIN `ajtdev`.`ajt_ass_veh_col` ON (`ajtdev`.`ajt_demande`.`id_ass_veh_col_fk` = `ajtdev`.`ajt_ass_veh_col`.`id`)
JOIN `ajtdev`.`ajt_vehicle` ON ( `ajtdev`.`ajt_ass_veh_col`.`veh_id_fk` = `ajtdev`.`ajt_vehicle`.`Id`)
JOIN `ajtdev`.`ajt_collaborator` ON (`ajtdev`.`ajt_ass_veh_col`.`col_id_fk` = `ajtdev`.`ajt_collaborator`.`Id`)
WHERE
ISNULL(`ajtdev`.`ajt_demande`.`deletion_date`)
and ISNULL(`ajtdev`.`ajt_collaborator`.`deletion_date`)
and ISNULL(`ajtdev`.`ajt_client`.`deletion_date`)
and ISNULL(`ajtdev`.`ajt_vehicle`.`deletion_date`)
and CONVERT(`ajtdev`.`ajt_collaborator`.`id_user_fk` USING UTF8)= id_compte;
end if;
END$$
DELIMITER ;
当我添加一个新的EF模型时,在上下文中我得到了这个mappage:
public virtual int ps_reservation(string id_compte)
{
var id_compteParameter = id_compte != null ?
new ObjectParameter("id_compte", id_compte) :
new ObjectParameter("id_compte", typeof(string));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("ps_reservation", id_compteParameter);
}
我不明白为什么我会获得此方法签名:
public virtual int ps_reservation(string id_compte)
我的意思是为什么返回类型是整数!!为什么不是ObjectResult<ps_reservation_Result>
?