저장 프로세스를 이용하여 데이터베이스 업데이트 문제를 향상시키다
36740 단어 C#
DELIMITER//
use protocoldb//
drop procedure if exists sp_protocol_Update//
create procedure sp_protocol_Update
(
in p_ProtocolNodeUID varchar(64),
in p_VersionUID varchar(64),
in p_ParentProtocolNodeUID varchar(64),
in p_IsDefaultSelected TINYINT(1),
in p_SequenceOrder INT(11),
in p_NodeType CHAR(50),
in p_NodeKey varchar(64),
in p_NodeLabel varchar(200),
in p_ExamedBodyPart varchar(200),
in p_ScanTypeSupported CHAR(50),
in p_PatientPosition CHAR(50),
in p_PrivateProtocolFilePath varchar(1024),
in p_Description varchar(1024),
in p_LeftRightFlag CHAR(50),
in p_AgeGroup CHAR(50),
in p_FileVersionNumber varchar(64),
in p_ExampleFigurePath varchar(1024),
in p_PatientTypeID varchar(64),
in p_ProcedureID varchar(64),
in p_PSASID varchar(64),
in p_ProtocolID varchar(64),
in p_IsFavourite TINYINT(1),
in p_IsTimed TINYINT(1),
in p_IsFactoryPredefine TINYINT(1),
in p_IsNeedInjection TINYINT(1),
in p_IsLicensed TINYINT(1),
in p_IsCardicScan TINYINT(1),
in p_IsPediatric TINYINT(1),
in p_CreateDate DATETIME,
in p_CreateBy varchar(64),
in p_UpdateDate DATETIME,
in p_UpdateBy varchar(64)
)
begin
update protocolnode set
VersionUID = p_VersionUID,
ParentProtocolNodeUID = p_ParentProtocolNodeUID,
IsDefaultSelected = p_IsDefaultSelected,
SequenceOrder = p_SequenceOrder,
NodeType = p_NodeType,
NodeKey = p_NodeKey,
NodeLabel = p_NodeLabel,
ExamedBodyPart = p_ExamedBodyPart,
ScanTypeSupported = p_ScanTypeSupported,
PatientPosition = p_PatientPosition,
PrivateProtocolFilePath = p_PrivateProtocolFilePath,
Description = p_Description,
LeftRightFlag = p_LeftRightFlag,
AgeGroup = p_AgeGroup,
FileVersionNumber = p_FileVersionNumber,
ExampleFigurePath = p_ExampleFigurePath,
PatientTypeID = p_PatientTypeID,
ProcedureID = p_ProcedureID,
PSASID = p_PSASID,
ProtocolID = p_ProtocolID,
IsFavourite = p_IsFavourite,
IsTimed = p_IsTimed,
IsFactoryPredefine = p_IsFactoryPredefine,
IsNeedInjection = p_IsNeedInjection,
IsLicensed = p_IsLicensed,
IsCardicScan = p_IsCardicScan,
IsPediatric = p_IsPediatric,
CreateDate = p_CreateDate,
CreateBy = p_CreateBy,
UpdateDate = p_UpdateDate,
UpdateBy = p_UpdateBy
where ProtocolNodeUID = p_ProtocolNodeUID;
end
//
DELIMITER ;
2. EF로 저장 프로세스 매핑
Model View에서 Function Import를 선택하여 저장 프로세스의 매핑 방법을 추가합니다.XXX와 같다.Designer.cs의
#region Function Imports /// <summary> /// No Metadata Documentation available. /// </summary> /// <param name="p_ProtocolNodeUID">No Metadata Documentation available.</param> /// <param name="p_VersionUID">No Metadata Documentation available.</param> /// <param name="p_ParentProtocolNodeUID">No Metadata Documentation available.</param> /// <param name="p_IsDefaultSelected">No Metadata Documentation available.</param> /// <param name="p_SequenceOrder">No Metadata Documentation available.</param> /// <param name="p_NodeType">No Metadata Documentation available.</param> /// <param name="p_NodeKey">No Metadata Documentation available.</param> /// <param name="p_NodeLabel">No Metadata Documentation available.</param> /// <param name="p_ExamedBodyPart">No Metadata Documentation available.</param> /// <param name="p_ScanTypeSupported">No Metadata Documentation available.</param> /// <param name="p_PatientPosition">No Metadata Documentation available.</param> /// <param name="p_PrivateProtocolFilePath">No Metadata Documentation available.</param> /// <param name="p_Description">No Metadata Documentation available.</param> /// <param name="p_LeftRightFlag">No Metadata Documentation available.</param> /// <param name="p_AgeGroup">No Metadata Documentation available.</param> /// <param name="p_FileVersionNumber">No Metadata Documentation available.</param> /// <param name="p_ExampleFigurePath">No Metadata Documentation available.</param> /// <param name="p_PatientTypeID">No Metadata Documentation available.</param> /// <param name="p_ProcedureID">No Metadata Documentation available.</param> /// <param name="p_PSASID">No Metadata Documentation available.</param> /// <param name="p_ProtocolID">No Metadata Documentation available.</param> /// <param name="p_IsFavourite">No Metadata Documentation available.</param> /// <param name="p_IsTimed">No Metadata Documentation available.</param> /// <param name="p_IsFactoryPredefine">No Metadata Documentation available.</param> /// <param name="p_IsNeedInjection">No Metadata Documentation available.</param> /// <param name="p_IsLicensed">No Metadata Documentation available.</param> /// <param name="p_IsCardicScan">No Metadata Documentation available.</param> /// <param name="p_IsPediatric">No Metadata Documentation available.</param> /// <param name="p_CreateDate">No Metadata Documentation available.</param> /// <param name="p_CreateBy">No Metadata Documentation available.</param> /// <param name="p_UpdateDate">No Metadata Documentation available.</param> /// <param name="p_UpdateBy">No Metadata Documentation available.</param> public int sp_protocol_Update(global::System.String p_ProtocolNodeUID, global::System.String p_VersionUID, global::System.String p_ParentProtocolNodeUID, Nullable<global::System.SByte> p_IsDefaultSelected, Nullable<global::System.Int32> p_SequenceOrder, global::System.String p_NodeType, global::System.String p_NodeKey, global::System.String p_NodeLabel, global::System.String p_ExamedBodyPart, global::System.String p_ScanTypeSupported, global::System.String p_PatientPosition, global::System.String p_PrivateProtocolFilePath, global::System.String p_Description, global::System.String p_LeftRightFlag, global::System.String p_AgeGroup, global::System.String p_FileVersionNumber, global::System.String p_ExampleFigurePath, global::System.String p_PatientTypeID, global::System.String p_ProcedureID, global::System.String p_PSASID, global::System.String p_ProtocolID, Nullable<global::System.SByte> p_IsFavourite, Nullable<global::System.SByte> p_IsTimed, Nullable<global::System.SByte> p_IsFactoryPredefine, Nullable<global::System.SByte> p_IsNeedInjection, Nullable<global::System.SByte> p_IsLicensed, Nullable<global::System.SByte> p_IsCardicScan, Nullable<global::System.SByte> p_IsPediatric, Nullable<global::System.DateTime> p_CreateDate, global::System.String p_CreateBy, Nullable<global::System.DateTime> p_UpdateDate, global::System.String p_UpdateBy) { ObjectParameter p_ProtocolNodeUIDParameter; if (p_ProtocolNodeUID != null) { p_ProtocolNodeUIDParameter = new ObjectParameter("p_ProtocolNodeUID", p_ProtocolNodeUID); } else { p_ProtocolNodeUIDParameter = new ObjectParameter("p_ProtocolNodeUID", typeof(global::System.String)); } ObjectParameter p_VersionUIDParameter; if (p_VersionUID != null) { p_VersionUIDParameter = new ObjectParameter("p_VersionUID", p_VersionUID); } else { p_VersionUIDParameter = new ObjectParameter("p_VersionUID", typeof(global::System.String)); } ObjectParameter p_ParentProtocolNodeUIDParameter; if (p_ParentProtocolNodeUID != null) { p_ParentProtocolNodeUIDParameter = new ObjectParameter("p_ParentProtocolNodeUID", p_ParentProtocolNodeUID); } else { p_ParentProtocolNodeUIDParameter = new ObjectParameter("p_ParentProtocolNodeUID", typeof(global::System.String)); } ObjectParameter p_IsDefaultSelectedParameter; if (p_IsDefaultSelected.HasValue) { p_IsDefaultSelectedParameter = new ObjectParameter("p_IsDefaultSelected", p_IsDefaultSelected); } else { p_IsDefaultSelectedParameter = new ObjectParameter("p_IsDefaultSelected", typeof(global::System.SByte)); } ObjectParameter p_SequenceOrderParameter; if (p_SequenceOrder.HasValue) { p_SequenceOrderParameter = new ObjectParameter("p_SequenceOrder", p_SequenceOrder); } else { p_SequenceOrderParameter = new ObjectParameter("p_SequenceOrder", typeof(global::System.Int32)); } ObjectParameter p_NodeTypeParameter; if (p_NodeType != null) { p_NodeTypeParameter = new ObjectParameter("p_NodeType", p_NodeType); } else { p_NodeTypeParameter = new ObjectParameter("p_NodeType", typeof(global::System.String)); } ObjectParameter p_NodeKeyParameter; if (p_NodeKey != null) { p_NodeKeyParameter = new ObjectParameter("p_NodeKey", p_NodeKey); } else { p_NodeKeyParameter = new ObjectParameter("p_NodeKey", typeof(global::System.String)); } ObjectParameter p_NodeLabelParameter; if (p_NodeLabel != null) { p_NodeLabelParameter = new ObjectParameter("p_NodeLabel", p_NodeLabel); } else { p_NodeLabelParameter = new ObjectParameter("p_NodeLabel", typeof(global::System.String)); } ObjectParameter p_ExamedBodyPartParameter; if (p_ExamedBodyPart != null) { p_ExamedBodyPartParameter = new ObjectParameter("p_ExamedBodyPart", p_ExamedBodyPart); } else { p_ExamedBodyPartParameter = new ObjectParameter("p_ExamedBodyPart", typeof(global::System.String)); } ObjectParameter p_ScanTypeSupportedParameter; if (p_ScanTypeSupported != null) { p_ScanTypeSupportedParameter = new ObjectParameter("p_ScanTypeSupported", p_ScanTypeSupported); } else { p_ScanTypeSupportedParameter = new ObjectParameter("p_ScanTypeSupported", typeof(global::System.String)); } ObjectParameter p_PatientPositionParameter; if (p_PatientPosition != null) { p_PatientPositionParameter = new ObjectParameter("p_PatientPosition", p_PatientPosition); } else { p_PatientPositionParameter = new ObjectParameter("p_PatientPosition", typeof(global::System.String)); } ObjectParameter p_PrivateProtocolFilePathParameter; if (p_PrivateProtocolFilePath != null) { p_PrivateProtocolFilePathParameter = new ObjectParameter("p_PrivateProtocolFilePath", p_PrivateProtocolFilePath); } else { p_PrivateProtocolFilePathParameter = new ObjectParameter("p_PrivateProtocolFilePath", typeof(global::System.String)); } ObjectParameter p_DescriptionParameter; if (p_Description != null) { p_DescriptionParameter = new ObjectParameter("p_Description", p_Description); } else { p_DescriptionParameter = new ObjectParameter("p_Description", typeof(global::System.String)); } ObjectParameter p_LeftRightFlagParameter; if (p_LeftRightFlag != null) { p_LeftRightFlagParameter = new ObjectParameter("p_LeftRightFlag", p_LeftRightFlag); } else { p_LeftRightFlagParameter = new ObjectParameter("p_LeftRightFlag", typeof(global::System.String)); } ObjectParameter p_AgeGroupParameter; if (p_AgeGroup != null) { p_AgeGroupParameter = new ObjectParameter("p_AgeGroup", p_AgeGroup); } else { p_AgeGroupParameter = new ObjectParameter("p_AgeGroup", typeof(global::System.String)); } ObjectParameter p_FileVersionNumberParameter; if (p_FileVersionNumber != null) { p_FileVersionNumberParameter = new ObjectParameter("p_FileVersionNumber", p_FileVersionNumber); } else { p_FileVersionNumberParameter = new ObjectParameter("p_FileVersionNumber", typeof(global::System.String)); } ObjectParameter p_ExampleFigurePathParameter; if (p_ExampleFigurePath != null) { p_ExampleFigurePathParameter = new ObjectParameter("p_ExampleFigurePath", p_ExampleFigurePath); } else { p_ExampleFigurePathParameter = new ObjectParameter("p_ExampleFigurePath", typeof(global::System.String)); } ObjectParameter p_PatientTypeIDParameter; if (p_PatientTypeID != null) { p_PatientTypeIDParameter = new ObjectParameter("p_PatientTypeID", p_PatientTypeID); } else { p_PatientTypeIDParameter = new ObjectParameter("p_PatientTypeID", typeof(global::System.String)); } ObjectParameter p_ProcedureIDParameter; if (p_ProcedureID != null) { p_ProcedureIDParameter = new ObjectParameter("p_ProcedureID", p_ProcedureID); } else { p_ProcedureIDParameter = new ObjectParameter("p_ProcedureID", typeof(global::System.String)); } ObjectParameter p_PSASIDParameter; if (p_PSASID != null) { p_PSASIDParameter = new ObjectParameter("p_PSASID", p_PSASID); } else { p_PSASIDParameter = new ObjectParameter("p_PSASID", typeof(global::System.String)); } ObjectParameter p_ProtocolIDParameter; if (p_ProtocolID != null) { p_ProtocolIDParameter = new ObjectParameter("p_ProtocolID", p_ProtocolID); } else { p_ProtocolIDParameter = new ObjectParameter("p_ProtocolID", typeof(global::System.String)); } ObjectParameter p_IsFavouriteParameter; if (p_IsFavourite.HasValue) { p_IsFavouriteParameter = new ObjectParameter("p_IsFavourite", p_IsFavourite); } else { p_IsFavouriteParameter = new ObjectParameter("p_IsFavourite", typeof(global::System.SByte)); } ObjectParameter p_IsTimedParameter; if (p_IsTimed.HasValue) { p_IsTimedParameter = new ObjectParameter("p_IsTimed", p_IsTimed); } else { p_IsTimedParameter = new ObjectParameter("p_IsTimed", typeof(global::System.SByte)); } ObjectParameter p_IsFactoryPredefineParameter; if (p_IsFactoryPredefine.HasValue) { p_IsFactoryPredefineParameter = new ObjectParameter("p_IsFactoryPredefine", p_IsFactoryPredefine); } else { p_IsFactoryPredefineParameter = new ObjectParameter("p_IsFactoryPredefine", typeof(global::System.SByte)); } ObjectParameter p_IsNeedInjectionParameter; if (p_IsNeedInjection.HasValue) { p_IsNeedInjectionParameter = new ObjectParameter("p_IsNeedInjection", p_IsNeedInjection); } else { p_IsNeedInjectionParameter = new ObjectParameter("p_IsNeedInjection", typeof(global::System.SByte)); } ObjectParameter p_IsLicensedParameter; if (p_IsLicensed.HasValue) { p_IsLicensedParameter = new ObjectParameter("p_IsLicensed", p_IsLicensed); } else { p_IsLicensedParameter = new ObjectParameter("p_IsLicensed", typeof(global::System.SByte)); } ObjectParameter p_IsCardicScanParameter; if (p_IsCardicScan.HasValue) { p_IsCardicScanParameter = new ObjectParameter("p_IsCardicScan", p_IsCardicScan); } else { p_IsCardicScanParameter = new ObjectParameter("p_IsCardicScan", typeof(global::System.SByte)); } ObjectParameter p_IsPediatricParameter; if (p_IsPediatric.HasValue) { p_IsPediatricParameter = new ObjectParameter("p_IsPediatric", p_IsPediatric); } else { p_IsPediatricParameter = new ObjectParameter("p_IsPediatric", typeof(global::System.SByte)); } ObjectParameter p_CreateDateParameter; if (p_CreateDate.HasValue) { p_CreateDateParameter = new ObjectParameter("p_CreateDate", p_CreateDate); } else { p_CreateDateParameter = new ObjectParameter("p_CreateDate", typeof(global::System.DateTime)); } ObjectParameter p_CreateByParameter; if (p_CreateBy != null) { p_CreateByParameter = new ObjectParameter("p_CreateBy", p_CreateBy); } else { p_CreateByParameter = new ObjectParameter("p_CreateBy", typeof(global::System.String)); } ObjectParameter p_UpdateDateParameter; if (p_UpdateDate.HasValue) { p_UpdateDateParameter = new ObjectParameter("p_UpdateDate", p_UpdateDate); } else { p_UpdateDateParameter = new ObjectParameter("p_UpdateDate", typeof(global::System.DateTime)); } ObjectParameter p_UpdateByParameter; if (p_UpdateBy != null) { p_UpdateByParameter = new ObjectParameter("p_UpdateBy", p_UpdateBy); } else { p_UpdateByParameter = new ObjectParameter("p_UpdateBy", typeof(global::System.String)); } return base.ExecuteFunction("sp_protocol_Update", p_ProtocolNodeUIDParameter, p_VersionUIDParameter, p_ParentProtocolNodeUIDParameter, p_IsDefaultSelectedParameter, p_SequenceOrderParameter, p_NodeTypeParameter, p_NodeKeyParameter, p_NodeLabelParameter, p_ExamedBodyPartParameter, p_ScanTypeSupportedParameter, p_PatientPositionParameter, p_PrivateProtocolFilePathParameter, p_DescriptionParameter, p_LeftRightFlagParameter, p_AgeGroupParameter, p_FileVersionNumberParameter, p_ExampleFigurePathParameter, p_PatientTypeIDParameter, p_ProcedureIDParameter, p_PSASIDParameter, p_ProtocolIDParameter, p_IsFavouriteParameter, p_IsTimedParameter, p_IsFactoryPredefineParameter, p_IsNeedInjectionParameter, p_IsLicensedParameter, p_IsCardicScanParameter, p_IsPediatricParameter, p_CreateDateParameter, p_CreateByParameter, p_UpdateDateParameter, p_UpdateByParameter); } #endregion
3. 저장 프로세스 호출
그중protocolDB는entity 대상, spprotocol_Udpate는 저장 프로세스가 비치는 방법명입니다.
protocolDB.sp_protocol_Update( temp.ProtocolNodeUID, temp.VersionUID, temp.ParentProtocolNodeUID, Convert.ToSByte(temp.IsDefaultSelected), temp.SequenceOrder, temp.NodeType, temp.NodeKey, temp.NodeLabel, temp.ExamedBodyPart, temp.ScanTypeSupported, temp.PatientPosition, temp.PrivateProtocolFilePath, temp.Description, temp.LeftRightFlag, temp.AgeGroup, temp.FileVersionNumber, temp.ExampleFigurePath, temp.PatientTypeID, temp.ProcedureID, temp.PSASID, temp.ProtocolID, Convert.ToSByte(temp.IsFavourite), Convert.ToSByte(temp.IsTimed), Convert.ToSByte(temp.IsFactoryPredefine), Convert.ToSByte(temp.IsNeedInjection), Convert.ToSByte(temp.IsLicensed), Convert.ToSByte(temp.IsCardicScan), Convert.ToSByte(temp.IsPediatric), temp.CreateDate, temp.CreateBy, temp.UpdateDate, temp.UpdateBy );
4.
1) , :The specified FunctionImport is not mapped to a store function and cannot be executed.
, Model view, Function Import, delete, Add, 。
http://scottsdalewebstudio.com/blog/functionimport-is-not-mapped-to-a-store-function-error/
2)mysql tinyint(1) EF sbyte, EF bool。 , EF , 。
temp ,IsPediatric bool , Convert.ToSByte 。
Convert.ToSByte(temp.IsPediatric)
3)Mysql , delimiter 。
OUT 。 , , mysql delimiter ; //。 ; mysql 。mysql> delimiter //
mysql> CREATE PROCEDURE simpleproc (OUT param1 INT)
-> BEGIN
-> SELECT COUNT(*) INTO param1 FROM t;
-> END
-> //
Query OK, 0 rows affected (0.00 sec)
mysql> delimiter ;
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
WebView2를 Visual Studio 2017 Express에서 사용할 수 있을 때까지Evergreen .Net Framework SDK 4.8 VisualStudio2017에서 NuGet을 사용하기 때문에 패키지 관리 방법을 packages.config 대신 PackageReference를 사용해야...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.