2008-10-28 6 views

Répondre

0

Il semble que cette fonctionnalité n'est pas dans la version actuelle, mais a été soumis dans le code pour la prochaine version.

-1

Oui c'est.

Dim TableList As Generic.List(Of Database.Table1) = _ 
New SubSonic.Select().From("Table1"). _ 
Where("Col1").IsGreaterThan("Col2"). _ 
Or("Col1").IsLessThan("Col3").ExecuteTypedList(Of Database.Table1)() 
2

Si c'est dans notre pile je ne peux pas le trouver :). Ce serait une bonne chose à ajouter si :). Vous pouvez, pour l'instant, utiliser une requête Inline pour simplement exécuter l'instruction que vous avez écrite (cela prend directement du code SQL). Je sais que c'est fugly mais ...

Rick - si vous aviez obtenu que cela fonctionne, je serais intéressé par le comment. "Col2" essayera et sera analysé à un type et votre requête échouera.

0

Si vous utilisez SubSonic 2.1/2.2 et vous avez accès à la source que vous pouvez appliquer les éléments suivants:

SubSonic/sqlquery/Constraint.cs
(Ajouter une nouvelle propriété)

public bool ParameterIsTableColumn 
{ 
    get { return ParameterValue is TableSchema.TableColumn ; } 
} 

SubSonic/sqlquery/SqlQuery.cs
(Inside S Procédé etConstraintParams)

foreach(Constraint c in qry.Constraints) 
{ 
    if (c.ConstructionFragment == "##" || c.ParameterIsTableColumn) 
     continue; 

SubSonic/SQLQuery/SqlGenerators/ANSISqlGenerator.cs
(méthode A l'intérieur BuildConstraintSQL)

//add this at the top of the method 
int currentConstraintIndex = query.Constraints.IndexOf(c); 

///the statement 'c.ParameterName = ' occurs four times in this method 
///use this line the first three times, and a slight variation of it on the fourth 
c.ParameterName = (c.ParameterIsTableColumn ? ((TableSchema.TableColumn)c.ParameterValue).QualifiedName : String.Concat(col.ParameterName, currentConstraintIndex)); 
Questions connexes