This project is read-only.

The changes listed here relate to
DF 4.3.208.0
DFP 4.3.124.0

Breaking changes

1. Changes to  Fuse8.DomainFramework.DataAccess.SqlDatabase.ISqlSchemaBuilder

was:
IList<string> GetStoredProcedureParameters(SqlConnection connection, SqlTransaction transaction, string sp);

now:
IList<SqlProcedureParameter> GetStoredProcedureParameters(SqlConnection connection, SqlTransaction transaction, string sp);

comments:

It is needed to be able to get from SQL server columns of table parameter.
The order of adding columns to C# DataTable is important and should be the same as the order of columns in SQL definition.
MsSqlSchemaBuilder has correct implementation of this functionality.

How to adopt your code:
Change the return value to the list of SqlProcedureParameter. If you are going to use table parameters then implement this in your scheme builder.


2. Changes to  IDbUnitOfWork

was:
IDbUnitOfWork<T>

now:
Non generic

comments:

It is needed to be able to get actual SQL connection and transaction in dynamic SQL repository helper code

How to adopt your code:
Remove generic using. Anyway it was not needed.

 

New functionality description

Added supporting of table parameters for stored procedures.

Note: parameter name on SQL side should be the same as property name in the parameter on the C# side

Note: table type columns on SQL side should have the same names as property names on C# side

Note: ADO.NET will generate insert statements before calling stored procedures. So bear in mind performance.

SQL server side

Create user defined table type

create type dbo.ListIds as table(Id int, Name nvarchar(500))

Create stored procedure

create procedure cusp_EntityGetByIds
(
       @Ids dbo.ListIds readonly
)
as
select
e.* from Entities e
inner join @Ids i on i.Id = e.Id and i.Name = e.Name

Note: readonly is required

 

C# side

Create parameter

public class GetByIdsCommandParameter : ICommandParameter
{
       public List<SimpleName> Ids { get; set; }
}

public class SimpleName
{
   public int Id { get; set; }
   public string Name { get; set; }
}

Call command

new BusinessServiceFacade<Entity, int>().Find(new GetByIdsCommandParameter(){Ids = new List<SimpleName>{new SimpleName()}});

 

// SQL

declare @t dbo.ListIds
insert into @t(Id, Name) values(1, ‘test’)
exec cusp_EntityGetByIds @t

Last edited Dec 16, 2013 at 4:10 AM by SergeiP, version 10

Comments

No comments yet.