1
在我的應用程序中,我通常使用企業庫數據塊來簡化數據庫交互。 C#代碼,如:MS企業庫數據塊將XML傳遞到具有XML參數的存儲過程中
public static IDataReader AdminNavigation_Insert(int iGroupId, string sText, string sRelativeUrl, int iSortOrder)
{
return DatabaseFactory.CreateDatabase("database").ExecuteReader(
"cms_uspAdminNavigation_Insert",
iGroupId,
sText,
sRelativeUrl,
iSortOrder);
}
會插入到像一個存儲過程:現在
ALTER PROCEDURE [dbo].[cms_uspAdminNavigation_Insert]
@GroupId int,
@Text nvarchar(500) = NULL,
@RelativeUrl varchar(100) = NULL,
@SortOrder int
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO dbo.cms_tblAdminNavigation (
GroupId, Text, RelativeUrl, SortOrder, TsCreated, TsUpdated
) VALUES (
@GroupId, @Text, @RelativeUrl, @SortOrder, getDate(), getDate()
);
SELECT @@IDENTITY;
END
,如果這些存儲過程的參數之一是XML,我會用什麼C#的數據類型傳遞到存儲通過企業庫的過程?