const string sqlSelect = @"
SELECT
a.tcns001_Id AS aid,
a.tcns005_idImmobile AS aidim,
a.tcns005_prog AS aprog,
FROM cnsf_005_uiu AS a
ORDER BY aidim, aprog";
var session = NHFactory.Session;
var enumerable = session
.CreateSQLQuery(sqlSelect)
.SetFirstResult(1).SetMaxResults(1)
.SetResultTransformer(Transformers.AliasToEntityMap)
.List<IDictionary>()
.Select(r => new
{
aId = r["aid"],
aIdImmobile = r["aidim"],
aProg = r["aprog"],
});
qualcuno ha un idea?
mi sa tanto di bug...
... Failed[NHibernate.AdoNet.Util.SqlStatementLogger.LogCommand] DEBUG
SELECT TOP (@p0) aid, aidim, aprog FROM (
SELECT
a.tcns001_Id AS aid,
a.tcns005_idImmobile AS aidim,
a.tcns005_prog AS aprog,
, ROW_NUMBER() OVER(ORDER BY aidim, aprog) as __hibernate_sort_row
FROM cnsf_005_uiu AS a) as query WHERE query.__hibernate_sort_row >
@p1 ORDER BY query.__hibernate_sort_row;@p0 = 1 [Type: Int32 (0)], @p1
= 1 [Type: Int32 (0)]
[NHibernate.AdoNet.Util.SqlStatementLogger.LogCommand] DEBUG SELECT
TOP (@p0) aid, aidim, aprog FROM (
SELECT
a.tcns001_Id AS aid,
a.tcns005_idImmobile AS aidim,
a.tcns005_prog AS aprog,
, ROW_NUMBER() OVER(ORDER BY aidim, aprog) as __hibernate_sort_row
FROM cnsf_005_uiu AS a) as query WHERE query.__hibernate_sort_row >
@p1 ORDER BY query.__hibernate_sort_row;@p0 = 1 [Type: Int32 (0)], @p1
= 1 [Type: Int32 (0)]
[NHibernate.AdoNet.AbstractBatcher.ExecuteReader] ERROR Could not
execute query: SELECT TOP (@p0) aid, aidim, aprog FROM (
SELECT
a.tcns001_Id AS aid,
a.tcns005_idImmobile AS aidim,
a.tcns005_prog AS aprog,
, ROW_NUMBER() OVER(ORDER BY aidim, aprog) as __hibernate_sort_row
FROM cnsf_005_uiu AS a) as query WHERE query.__hibernate_sort_row >
@p1 ORDER BY query.__hibernate_sort_row
System.Data.SqlClient.SqlException (0x80131904): Sintassi non corretta
in prossimità di ','.
at System.Data.SqlClient.SqlConnection.OnError(SqlException
exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,
RunBehavior runBehavior, String resetOptionsString)
at
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean
async)
at
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method, DbAsyncResult result)
at
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior, String method)
at
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior
behavior)
at
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
in d:\CSharp\NH\NH\nhibernate\src\NHibernate\AdoNet
\AbstractBatcher.cs:line 246
[NHibernate.Util.ADOExceptionReporter.LogExceptions] WARN
System.Data.SqlClient.SqlException (0x80131904): Sintassi non corretta
in prossimità di ','.
at System.Data.SqlClient.SqlConnection.OnError(SqlException
exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,
RunBehavior runBehavior, String resetOptionsString)
at
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean
async)
at
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method, DbAsyncResult result)
at
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior, String method)
at
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior
behavior)
at
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
in d:\CSharp\NH\NH\nhibernate\src\NHibernate\AdoNet
\AbstractBatcher.cs:line 270
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean
autoDiscoverTypes, Boolean callable, RowSelection selection,
ISessionImplementor session) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Loader\Loader.cs:line 1221
[NHibernate.Util.ADOExceptionReporter.LogExceptions] ERROR Sintassi
non corretta in prossimità di ','.
[NHibernate.Util.ADOExceptionReporter.LogExceptions] WARN
System.Data.SqlClient.SqlException (0x80131904): Sintassi non corretta
in prossimità di ','.
at System.Data.SqlClient.SqlConnection.OnError(SqlException
exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,
RunBehavior runBehavior, String resetOptionsString)
at
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean
async)
at
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method, DbAsyncResult result)
at
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior, String method)
at
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior
behavior)
at
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
in d:\CSharp\NH\NH\nhibernate\src\NHibernate\AdoNet
\AbstractBatcher.cs:line 270
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean
autoDiscoverTypes, Boolean callable, RowSelection selection,
ISessionImplementor session) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Loader\Loader.cs:line 1247
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session,
QueryParameters queryParameters, Boolean returnProxies) in d:\CSharp\NH
\NH\nhibernate\src\NHibernate\Loader\Loader.cs:line 416
at
NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor
session, QueryParameters queryParameters, Boolean returnProxies) in d:
\CSharp\NH\NH\nhibernate\src\NHibernate\Loader\Loader.cs:line 246
at NHibernate.Loader.Loader.DoList(ISessionImplementor session,
QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Loader\Loader.cs:line 1590
[NHibernate.Util.ADOExceptionReporter.LogExceptions] ERROR Sintassi
non corretta in prossimità di ','.
[NHibernate.Util.ADOExceptionReporter.LogExceptions] WARN
System.Data.SqlClient.SqlException (0x80131904): Sintassi non corretta
in prossimità di ','.
at System.Data.SqlClient.SqlConnection.OnError(SqlException
exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,
RunBehavior runBehavior, String resetOptionsString)
at
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean
async)
at
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method, DbAsyncResult result)
at
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior, String method)
at
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior
behavior)
at
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
in d:\CSharp\NH\NH\nhibernate\src\NHibernate\AdoNet
\AbstractBatcher.cs:line 270
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean
autoDiscoverTypes, Boolean callable, RowSelection selection,
ISessionImplementor session) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Loader\Loader.cs:line 1247
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session,
QueryParameters queryParameters, Boolean returnProxies) in d:\CSharp\NH
\NH\nhibernate\src\NHibernate\Loader\Loader.cs:line 416
at
NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor
session, QueryParameters queryParameters, Boolean returnProxies) in d:
\CSharp\NH\NH\nhibernate\src\NHibernate\Loader\Loader.cs:line 246
at NHibernate.Loader.Loader.DoList(ISessionImplementor session,
QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Loader\Loader.cs:line 1590
[NHibernate.Util.ADOExceptionReporter.LogExceptions] ERROR Sintassi
non corretta in prossimità di ','.
NHibernate.Exceptions.GenericADOException : could not execute query
[ SELECT TOP (@p0) aid, aidim, aprog FROM (
SELECT
a.tcns001_Id AS aid,
a.tcns005_idImmobile AS aidim,
a.tcns005_prog AS aprog,
, ROW_NUMBER() OVER(ORDER BY aidim, aprog) as __hibernate_sort_row
FROM cnsf_005_uiu AS a) as query WHERE query.__hibernate_sort_row >
@p1 ORDER BY query.__hibernate_sort_row ]
[SQL: SELECT TOP (@p0) aid, aidim, aprog FROM (
SELECT
a.tcns001_Id AS aid,
a.tcns005_idImmobile AS aidim,
a.tcns005_prog AS aprog,
, ROW_NUMBER() OVER(ORDER BY aidim, aprog) as __hibernate_sort_row
FROM cnsf_005_uiu AS a) as query WHERE query.__hibernate_sort_row >
@p1 ORDER BY query.__hibernate_sort_row]
----> System.Data.SqlClient.SqlException : Sintassi non corretta in
prossimità di ','.
at NHibernate.Loader.Loader.DoList(ISessionImplementor session,
QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Loader\Loader.cs: line 1607
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor
session, QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate
\src\NHibernate\Loader\Loader.cs: line 1497
at NHibernate.Impl.SessionImpl.ListCustomQuery(ICustomQuery
customQuery, QueryParameters queryParameters, IList results) in d:
\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\SessionImpl.cs: line 2089
at NHibernate.Impl.SessionImpl.List(NativeSQLQuerySpecification spec,
QueryParameters queryParameters, IList results) in d:\CSharp\NH\NH
\nhibernate\src\NHibernate\Impl\SessionImpl.cs: line 2071
at NHibernate.Impl.SessionImpl.List(NativeSQLQuerySpecification spec,
QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Impl\SessionImpl.cs: line 2058
at NHibernate.Impl.SqlQueryImpl.List() in d:\CSharp\NH\NH\nhibernate
\src\NHibernate\Impl\SqlQueryImpl.cs: line 163
at EtlCensTests.TestETL.CanLoadCnsStadioUIU.CanBuildGrafoMutazioni1()
in CanLoadCnsStadioUIU.cs: line 443
--SqlException
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception,
Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader
ds, RunBehavior runBehavior, String resetOptionsString)
at
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean
async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior, String method)
at
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior
behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) in
d:\CSharp\NH\NH\nhibernate\src\NHibernate\AdoNet\AbstractBatcher.cs:
line 270
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean
autoDiscoverTypes, Boolean callable, RowSelection selection,
ISessionImplementor session) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Loader\Loader.cs: line 1247
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session,
QueryParameters queryParameters, Boolean returnProxies) in d:\CSharp\NH
\NH\nhibernate\src\NHibernate\Loader\Loader.cs: line 416
at
NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor
session, QueryParameters queryParameters, Boolean returnProxies) in d:
\CSharp\NH\NH\nhibernate\src\NHibernate\Loader\Loader.cs: line 246
at NHibernate.Loader.Loader.DoList(ISessionImplementor session,
QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Loader\Loader.cs: line 1590
leggi l'errore:
NHibernate.Util.ADOExceptionReporter.LogExceptions] ERROR Sintassi
non corretta in prossimità di ','.
> SELECT
> a.tcns001_Id AS aid,
> a.tcns005_idImmobile AS aidim,
> a.tcns005_prog AS aprog, <--------------------------------- l'ultima virgola non ci stà
> FROM cnsf_005_uiu AS a
quindi con firstresult/maxresult il test non passa senza passa
riposto il tutto
const string sqlSelect = @"
SELECT
a.tcns001_Id AS aid,
a.tcns005_idImmobile AS aidim,
a.tcns005_prog AS aprog
FROM cnsf_005_uiu AS a
ORDER BY aidim, aprog";
var session = NHFactory.Session;
var enumerable = session
.CreateSQLQuery(sqlSelect)
.SetFirstResult(1).SetMaxResults(1)
.SetResultTransformer(Transformers.AliasToEntityMap)
.List<IDictionary>()
.Select(r => new
{
aId = r["aid"],
aIdImmobile = r["aidim"],
aProg = r["aprog"],
});
}
[NHibernate.AdoNet.Util.SqlStatementLogger.LogCommand] DEBUG SELECT
TOP (@p0) aid, aidim, aprog FROM (
SELECT
a.tcns001_Id AS aid,
a.tcns005_idImmobile AS aidim,
a.tcns005_prog AS aprog
, ROW_NUMBER() OVER(ORDER BY aidim, aprog) as __hibernate_sort_row
FROM cnsf_005_uiu AS a) as query WHERE query.__hibernate_sort_row >
@p1 ORDER BY query.__hibernate_sort_row;@p0 = 1 [Type: Int32 (0)], @p1
= 1 [Type: Int32 (0)]
[NHibernate.AdoNet.Util.SqlStatementLogger.LogCommand] DEBUG SELECT
TOP (@p0) aid, aidim, aprog FROM (
SELECT
a.tcns001_Id AS aid,
a.tcns005_idImmobile AS aidim,
a.tcns005_prog AS aprog
, ROW_NUMBER() OVER(ORDER BY aidim, aprog) as __hibernate_sort_row
FROM cnsf_005_uiu AS a) as query WHERE query.__hibernate_sort_row >
@p1 ORDER BY query.__hibernate_sort_row;@p0 = 1 [Type: Int32 (0)], @p1
= 1 [Type: Int32 (0)]
[NHibernate.AdoNet.AbstractBatcher.ExecuteReader] ERROR Could not
execute query: SELECT TOP (@p0) aid, aidim, aprog FROM (
SELECT
a.tcns001_Id AS aid,
a.tcns005_idImmobile AS aidim,
a.tcns005_prog AS aprog
, ROW_NUMBER() OVER(ORDER BY aidim, aprog) as __hibernate_sort_row
FROM cnsf_005_uiu AS a) as query WHERE query.__hibernate_sort_row >
@p1 ORDER BY query.__hibernate_sort_row
System.Data.SqlClient.SqlException (0x80131904): Il nome di colonna
'aidim' non è valido.
Il nome di colonna 'aprog' non è valido.
System.Data.SqlClient.SqlException (0x80131904): Il nome di colonna
'aidim' non è valido.
Il nome di colonna 'aprog' non è valido.
[NHibernate.Util.ADOExceptionReporter.LogExceptions] ERROR Il nome di
colonna 'aidim' non è valido.
Il nome di colonna 'aprog' non è valido.
[NHibernate.Util.ADOExceptionReporter.LogExceptions] WARN
System.Data.SqlClient.SqlException (0x80131904): Il nome di colonna
'aidim' non è valido.
Il nome di colonna 'aprog' non è valido.
[NHibernate.Util.ADOExceptionReporter.LogExceptions] ERROR Il nome di
colonna 'aidim' non è valido.
Il nome di colonna 'aprog' non è valido.
[NHibernate.Util.ADOExceptionReporter.LogExceptions] WARN
System.Data.SqlClient.SqlException (0x80131904): Il nome di colonna
'aidim' non è valido.
Il nome di colonna 'aprog' non è valido.
[NHibernate.Util.ADOExceptionReporter.LogExceptions] ERROR Il nome di
colonna 'aidim' non è valido.
Il nome di colonna 'aprog' non è valido.
NHibernate.Exceptions.GenericADOException : could not execute query
[ SELECT TOP (@p0) aid, aidim, aprog FROM (
SELECT
a.tcns001_Id AS aid,
a.tcns005_idImmobile AS aidim,
a.tcns005_prog AS aprog
, ROW_NUMBER() OVER(ORDER BY aidim, aprog) as __hibernate_sort_row
FROM cnsf_005_uiu AS a) as query WHERE query.__hibernate_sort_row >
@p1 ORDER BY query.__hibernate_sort_row ]
[SQL: SELECT TOP (@p0) aid, aidim, aprog FROM (
SELECT
a.tcns001_Id AS aid,
a.tcns005_idImmobile AS aidim,
a.tcns005_prog AS aprog
, ROW_NUMBER() OVER(ORDER BY aidim, aprog) as __hibernate_sort_row
FROM cnsf_005_uiu AS a) as query WHERE query.__hibernate_sort_row >
@p1 ORDER BY query.__hibernate_sort_row]
----> System.Data.SqlClient.SqlException : Il nome di colonna
'aidim' non è valido.
Il nome di colonna 'aprog' non è valido.
at NHibernate.Loader.Loader.DoList(ISessionImplementor session,
QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Loader\Loader.cs: line 1607
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor
session, QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate
\src\NHibernate\Loader\Loader.cs: line 1497
at NHibernate.Impl.SessionImpl.ListCustomQuery(ICustomQuery
customQuery, QueryParameters queryParameters, IList results) in d:
\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\SessionImpl.cs: line 2089
at NHibernate.Impl.SessionImpl.List(NativeSQLQuerySpecification spec,
QueryParameters queryParameters, IList results) in d:\CSharp\NH\NH
\nhibernate\src\NHibernate\Impl\SessionImpl.cs: line 2071
at NHibernate.Impl.SessionImpl.List(NativeSQLQuerySpecification spec,
QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Impl\SessionImpl.cs: line 2058
at NHibernate.Impl.SqlQueryImpl.List() in d:\CSharp\NH\NH\nhibernate
\src\NHibernate\Impl\SqlQueryImpl.cs: line 163
at EtlCensTests.TestETL.CanLoadCnsStadioUIU.Test() in
> ...
>
> leggi tutto
const string sqlSelect = @"
SELECT
a.tcns001_Id AS aid,
a.tcns005_idImmobile AS aidim,
a.tcns005_prog AS aprog
FROM cnsf_005_uiu AS a
ORDER BY a.tcns005_idImmobile, a.tcns005_prog"; // usando i nomi
delle colonne invece degli alias
> ...
>
> read more »
ma da errore con questa: il nome di colonna xyz non � valido (anche se
non riscontra nessun errore nella sintassi)
SELECT TOP 100 *
FROM (
SELECT tcns001_Id, tcns005_idImmobile as xyz, tcns005_prog,
ROW_NUMBER() OVER(ORDER BY xyz, tcns005_prog) as __hibernate_sort_row
FROM cnsf_005_uiu
) as query
WHERE query.__hibernate_sort_row > 100
ORDER BY query.__hibernate_sort_row
grazie per l'aiuto
t.
>> 'aidim' non � valido.
>> Il nome di colonna 'aprog' non � valido.
>> 'aidim' non � valido.
>> Il nome di colonna 'aprog' non � valido.
>> colonna 'aidim' non � valido.
>> Il nome di colonna 'aprog' non � valido.
>> [NHibernate.Util.ADOExceptionReporter.LogExceptions] WARN
>> System.Data.SqlClient.SqlException (0x80131904): Il nome di colonna
>> 'aidim' non � valido.
>> Il nome di colonna 'aprog' non � valido.
>> colonna 'aidim' non � valido.
>> Il nome di colonna 'aprog' non � valido.
>> [NHibernate.Util.ADOExceptionReporter.LogExceptions] WARN
>> System.Data.SqlClient.SqlException (0x80131904): Il nome di colonna
>> 'aidim' non � valido.
>> Il nome di colonna 'aprog' non � valido.
>> read more �
public static IList<T> ToDtoList<T>(this IQuery query)
{
return
query.SetResultTransformer(Transformers.AliasToBean(typeof(T))).List<T>();
}
dove T è un dto e IQuery contiene una Hql query fatta tipo:
select c.FirstName as FirstName, c.LastName as LastName from Customer
c
e T è
public class CustomerDto{
public string FirstName {get;set;}
public string LastName {get;set;}
}
così lasci ad nh di preoccuparsi del resto.
> ...
>
> leer más »
1) la list non serve, ho bisogno un dictionary per recuperare le
tuple tramite una chiave ed effettuare delle trasformazioni complesse
e poi istanziare diversi oggetti di dominio
2) nel mio contesto il dto è superfluo: devo solo trasformare dei dati
legacy da una fonte esterna non OO e creare un nuovo dominio object
oriented
3) non ho ancora avuto il tempo di approfondire tutte le classi
trasformer di NH :(
piuttosto a me sarebber servito non usare una sql nativa (molto
grossa) ma usare queryobject o linq to NH (così da evitare le magic
string) ma purtroppo no se puede: sai vero che che nessuno dei due
supporta un left join su campi che non sono associazioni?
cmq grazie del suggerimento
t.
> ...
>
> leggi tutto