Have dsl for executing InsertInto statements and it has this kind of signature:
ICustomInterface<T1, T2, T3> InsertInto<T1, T2, T3>(string tableName, CustomType type1,
CustomType type2,CustomType type3);
Example:
var actualInsert = this._sql
.InsertInto<int, string, int>("dbo.Words",
type1,//this is some custom sql type
type2,
type3
)
.Values(
(43, "newVal2", 42), //actual values
(44, "newVal3", 42)
)
Problem I am having is that it will not work on endless type parameters. One kind of resolution I am thinking is make this kind of method:
ICustomInterface<TRes> InsertInto<TRes>(string tableName, params CustomType[] types)
where TRes : ITuple;
But it is not beautiful (You need to type it in brackates - InsertInto<(int,string,int)>
) and can not be sure that CustomType[]
array length will be equal as TRes
tuple items length. Anyone have better idea?