Ok, that was a stupid title. But hey, I’m not a comedian.
Just finished looking through the Stored Procedure Object Interface Layer (SPOIL) write up on MSDN’s Solution Architecture Center. SPOIL allows you to declaratively link a method with the same signature as the stored procedure (except using BCL types) together. For example, take this stored procedure sample:
CREATE PROCEDURE [dbo].[SendLog_Update]
(
@BatchId uniqueidentifier,
@PartnerId nvarchar(50),
@Mailbox nvarchar(50),
@RootName nvarchar(100),
@Directory nvarchar(100),
@StartPackaging datetime,
@TotalBytes bigint,
@SendBytes bigint
) …
To something like this in code:
[SqlCommandMethod(CommandType.StoredProcedure, "SendLog_Update")]
public int SendLog_Update(
Guid BatchId,
[SqlParameter(50)] string PartnerId,
[SqlParameter(50)] string Mailbox,
[SqlParameter(100)] string RootName,
[SqlParameter(100)] string Directory,
DateTime StartPackaging,
long TotalBytes,
long SendBytes)
{ ... }
Kinda different, huh? Check it out and let me know what you guys think!