Call a stored procedure

Initialization:

public void Init(IUnityContainer container)
{
    container.RegisterSimpleSql<Development>();
}

public static void InitCommand(IUnityContainer container)
{
    container.RegisterType(typeof(IEntityDataCommand<,,>), typeof(SqlBaseCommand<,,>));
}

Create a command parameter.

using Fuse8.DomainFramework.Practices.Domain.Interfaces;

public class FindASpecialOneCommandParameter : ICommandParameter
{
    public int SomeParameter { get; set; }

    public FindASpecialOneCommandParameter(int someParameter)
    {
        SomeParameter = someParameter;
    }

    public string CacheKey()
    {
        return string.Format("FindASpecialOne_{0}", SomeParameter);
    }
}

Call

var development = new BusinessServiceFacade<Development, int>().FindOne(new FindASpecialOneCommandParameter(someParameter));

Create a stored procedure

A stored procedure name should use the following naming convention cusp_EntityNameCommanParameterName.

CREATE PROCEDURE [dbo].[cusp_DevelopmentFindASpecialOne]
	@SomeParameter int
AS
BEGIN
	SELECT d.*  FROM Developments d	
	where d.Id = @SomeParameter	
END

Last edited Apr 1, 2013 at 4:49 AM by olgabutova, version 4

Comments

No comments yet.