null value with selfservicing and UnitOfWork when saving

Posts   
 
    
braidiano
User
Posts: 40
Joined: 18-Nov-2006
# Posted on: 08-Apr-2008 10:25:06   

Hi!

LLBLGen Pro 2.5 final March 28th, 2008

Runtime library version: 2.5.08.0328 .NET 2.0 SelfServicing SQL Server 2005 Express & Developer

We have an issue when saving an entity (that contains some related entities inside) in an UnitOfWork. Inside the method DocumentiManager.CommitUnitOfWork() it simply calls:


uow.Commit(new Transaction(IsolationLevel.ReadCommited,"UOW"),true);

before Commit(..) invocation, all the fields are valorized (i checked at runtime in debug) but during Commit execution something happens so entity.IDFiliale becomes NULL (i noticed that IDFiliale parameters disappears on exception query params!)

This is the Exception:


Eccezione SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException
08/04/2008 9.46.34
An exception was caught during the execution of an action query: Cannot insert the value NULL into column 'IDFiliale', table 'GenioDB11.dbo.Documenti'; column does not allow nulls. INSERT fails.
The statement has been terminated.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.

STACKTRACE
   at Genio.Business.Managers.Documenti.DocumentiManager.CommitUnitOfWork()
   at Genio.Business.Managers.Documenti.DocumentiManager.SalvaNuovoDocumento(DocumentiEntity doc, ScadenzeCollection scadenze, DocumentiCollection documentiInclusi, Int32 idDepositoScaricoMagazzino, Int32 idUtente, Boolean assegnaNumero, Nullable`1 numeroDocumentoPassivo, String numeroDocAlfanumericoPassivo, Boolean generaProvvigione, Nullable`1 metodo)
   at Genio.UI.Documenti.FormNuovoDocumento.btSalvaDocumento_Click(Object sender, EventArgs e)
INNER
System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'IDFiliale', table 'GenioDB11.dbo.Documenti'; column does not allow nulls. INSERT fails.
The statement has been terminated.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   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.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at SD.LLBLGen.Pro.ORMSupportClasses.ActionQuery.Execute()
DATABASE QUERY

    Query: INSERT INTO [GenioDB11].[dbo].[Documenti] ([Numero], [IDAnnoContabile], [DataEmissione], [IDTipoDocumento], [IDClienteFornitore], [IDContoCorrente], [TotaleImponibile], [TotaleIva], [TotaleDocumento], [IDAspettoDeiBeni], [DataOraInizioTrasporto], [RagioneSocialeFatturazione], [RagioneSocialeFatturazione2], [IndirizzoFatturazione], [ProvinciaFatturazione], [CapFatturazione], [CittaFatturazione], [Piva], [CodiceFiscale], [TelefonoFatturazione], [RagioneSocialeConsegna], [RagioneSocialeConsegna2], [IndirizzoConsegna], [CittaConsegna], [CapConsegna], [ProvinciaConsegna], [TelConsegna], [Annotazioni], [IDPortoTrasporto], [IDMezzoTrasporto], [NumeroColli], [PesoKG], [IDTipoPagamentoScadenze], [IDAgente], [SpeseTrasportoFuoriIva], [SpeseVarieFuoriIva], [SpeseIncassoFuoriIva], [TotaleSpeseFuoriIva])  VALUES (@Numero, @IdannoContabile, @DataEmissione, @IdtipoDocumento, @IdclienteFornitore, @IdcontoCorrente, @TotaleImponibile, @TotaleIva, @TotaleDocumento, @IdaspettoDeiBeni, @DataOraInizioTrasporto, @RagioneSocialeFatturazione, @RagioneSocialeFatturazione2, @IndirizzoFatturazione, @ProvinciaFatturazione, @CapFatturazione, @CittaFatturazione, @Piva, @CodiceFiscale, @TelefonoFatturazione, @RagioneSocialeConsegna, @RagioneSocialeConsegna2, @IndirizzoConsegna, @CittaConsegna, @CapConsegna, @ProvinciaConsegna, @TelConsegna, @Annotazioni, @IdportoTrasporto, @IdmezzoTrasporto, @NumeroColli, @PesoKg, @IdtipoPagamentoScadenze, @Idagente, @SpeseTrasportoFuoriIva, @SpeseVarieFuoriIva, @SpeseIncassoFuoriIva, @TotaleSpeseFuoriIva);SELECT @Iddocumento=SCOPE_IDENTITY()
    Parameter: @Iddocumento : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Output. Value: <undefined value>.
    Parameter: @Numero : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 1.
    Parameter: @IdannoContabile : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 2.
    Parameter: @DataEmissione : DateTime. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 08/04/2008 9.41.25.
    Parameter: @IdtipoDocumento : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 50.
    Parameter: @IdclienteFornitore : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 2373.
    Parameter: @IdcontoCorrente : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: <undefined value>.
    Parameter: @TotaleImponibile : Currency. Length: 0. Precision: 19. Scale: 4. Direction: Input. Value: 0.
    Parameter: @TotaleIva : Currency. Length: 0. Precision: 19. Scale: 4. Direction: Input. Value: 0.
    Parameter: @TotaleDocumento : Currency. Length: 0. Precision: 19. Scale: 4. Direction: Input. Value: 0.
    Parameter: @IdaspettoDeiBeni : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: <undefined value>.
    Parameter: @DataOraInizioTrasporto : DateTime. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 08/04/2008 9.41.25.
    Parameter: @RagioneSocialeFatturazione : AnsiString. Length: 100. Precision: 0. Scale: 0. Direction: Input. Value: "XXXXX YYYYY".
    Parameter: @RagioneSocialeFatturazione2 : AnsiString. Length: 100. Precision: 0. Scale: 0. Direction: Input. Value: "".
    Parameter: @IndirizzoFatturazione : AnsiString. Length: 100. Precision: 0. Scale: 0. Direction: Input. Value: "VIA DDDDDD, 7".
    Parameter: @ProvinciaFatturazione : AnsiString. Length: 2. Precision: 0. Scale: 0. Direction: Input. Value: "AA".
    Parameter: @CapFatturazione : AnsiString. Length: 10. Precision: 0. Scale: 0. Direction: Input. Value: "4444".
    Parameter: @CittaFatturazione : AnsiString. Length: 50. Precision: 0. Scale: 0. Direction: Input. Value: "ROMA".
    Parameter: @Piva : AnsiString. Length: 25. Precision: 0. Scale: 0. Direction: Input. Value: "544534534534".
    Parameter: @CodiceFiscale : AnsiString. Length: 25. Precision: 0. Scale: 0. Direction: Input. Value: "AAABBB71R19E532F".
    Parameter: @TelefonoFatturazione : AnsiString. Length: 20. Precision: 0. Scale: 0. Direction: Input. Value: "".
    Parameter: @RagioneSocialeConsegna : AnsiString. Length: 100. Precision: 0. Scale: 0. Direction: Input. Value: "AAAAAA EEEEE".
    Parameter: @RagioneSocialeConsegna2 : AnsiString. Length: 100. Precision: 0. Scale: 0. Direction: Input. Value: "".
    Parameter: @IndirizzoConsegna : AnsiString. Length: 100. Precision: 0. Scale: 0. Direction: Input. Value: "VIA AAAAAAA, 7".
    Parameter: @CittaConsegna : AnsiString. Length: 50. Precision: 0. Scale: 0. Direction: Input. Value: "CCCCC".
    Parameter: @CapConsegna : AnsiString. Length: 10. Precision: 0. Scale: 0. Direction: Input. Value: "CDFDF".
    Parameter: @ProvinciaConsegna : AnsiString. Length: 2. Precision: 0. Scale: 0. Direction: Input. Value: "AA".
    Parameter: @TelConsegna : AnsiString. Length: 20. Precision: 0. Scale: 0. Direction: Input. Value: "".
    Parameter: @Annotazioni : AnsiString. Length: 2147483647. Precision: 0. Scale: 0. Direction: Input. Value: "CONTRASSEGNO AAAAAAAAA".
    Parameter: @IdportoTrasporto : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 5.
    Parameter: @IdmezzoTrasporto : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 5.
    Parameter: @NumeroColli : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 0.
    Parameter: @PesoKg : AnsiString. Length: 20. Precision: 0. Scale: 0. Direction: Input. Value: "0".
    Parameter: @IdtipoPagamentoScadenze : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 90.
    Parameter: @Idagente : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 4.
    Parameter: @SpeseTrasportoFuoriIva : Currency. Length: 0. Precision: 19. Scale: 4. Direction: Input. Value: 0.
    Parameter: @SpeseVarieFuoriIva : Currency. Length: 0. Precision: 19. Scale: 4. Direction: Input. Value: 0.
    Parameter: @SpeseIncassoFuoriIva : Currency. Length: 0. Precision: 19. Scale: 4. Direction: Input. Value: 0.
    Parameter: @TotaleSpeseFuoriIva : Currency. Length: 0. Precision: 19. Scale: 4. Direction: Input. Value: 0.


Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 08-Apr-2008 11:14:25   

Why can't I see the IDFiliale field in the Insert Query parameters list? Or does it go by another name?

Anyway would you please post a code snippet of creating, filling the entity and adding it to the UoW?

braidiano
User
Posts: 40
Joined: 18-Nov-2006
# Posted on: 08-Apr-2008 11:28:36   

Why can't I see the IDFiliale field in the Insert Query parameters list?

The problem is just that.. Please pay attention in reading the post that I wrote:

before Commit(..) invocation, all the fields are valorized (i checked at runtime in debug) but during Commit execution something happens so entity.IDFiliale becomes NULL (i noticed that IDFiliale parameters disappears on exception query params!)

some code snippets:


 MovimentiMagazzinoEntity movimento = new MovimentiMagazzinoEntity();
.....
doc.MovimentiMagazzino.Add(movimento);



 m_UnitOfWork.AddForSave(doc, true);
 m_UnitOfWork.Commit(new Transaction(IsolationLevel.ReadCommitted, "UOW"), true);

If at runtime i check doc.IDFiliale BEFORE Commit(..) calls it got a value. doc.IDFiliale values disappears during commit execution. Any Suggestion?

Thanks!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 08-Apr-2008 16:50:08   

Please post more info, as we don't have your db, your code nor your project in front of us. It's an FK field I pressume? (as you don't explain that). What's MovimentiMagazzinoEntity role in this exactly? As you post a small snippet with that entity but it's unclear to me what it has to do with the IDFiliale field ?

If it has a value when you read it, can you check if: doc.Fields[_index of IDFiliale_].IsChanged is true?

If it's an FK field, and the PK of the entity it points to is in MovimentiMagazzinoEntity, is that PK a sequenced field? If so is it an identity field in the DB too?

So: - post table DDL SQL for both the entity IDFiliale is in and the table it points to - post as much code as possible which sets up the graph which is saved with the uow. - double-check if the PK (!) of the entity IDFiliale points to is indeed an identity field in the DB and the entity.

Frans Bouma | Lead developer LLBLGen Pro
braidiano
User
Posts: 40
Joined: 18-Nov-2006
# Posted on: 08-Apr-2008 18:04:59   

I explain flushed

In DB I have:

Documento table: IDDocumento (PK) ... IDFiliale (FK -> Filiale table) ...

MovimentoMagazzino table: IDMovimentoMagazzino (PK) .... IDDocumento (FK -> Documento table) IDFiliale (FK -> Filiale table) ....

RigheDocumento table: IDRigaDocumento (PK) IDocumento (FK -> Documento table) .....

in DocumentoManager, before saving i have this scenario (where doc is a DocumentoEntity instance) :


doc.RigheDocumenti.Count = 2;

next:




MovimentoMagazzinoEntity movimento;
foreach (RigaDocumentoEntity riga in doc.RigheDocumento)
{
      movimento = new MovimentoMagazzinoEntity(); 
      movimento.IDFiliale = doc.IDFiliale;
      ...........
      doc.MovimentoMagazzino.Add(movimento);
}

uow.AddForSave(doc,true);



I start debugging using runtime library source code ... so i noticed that when it builds the 2th INSERT INTO query of MovimentoMagazzinoEntity (because doc.MovimentoMagazzino.Count =2, and there was 2 entity to insert) when it executes the method:

protected virtual bool CheckIfFieldNeedsInsertAction(IEntityFieldCore field)

inside it field.IsChanged (when field.Name is "IDFiliale") becomes false.. So it skips the IDFiliale parameter during the second query building.

I think that this appens due to "foreach" that use the same "movimento" variable. Is this possible?

DDL SQL:


CREATE TABLE [dbo].[Documenti] (
  [IDDocumento]int IDENTITY(1, 1) NOT NULL,
  ..............
  [IDFiliale]int NOT NULL,
 .................  
  CONSTRAINT [Documenti_PK] PRIMARY KEY CLUSTERED ([IDDocumento]),
...............  
  CONSTRAINT [Filiali_Documenti_FK1] FOREIGN KEY ([IDFiliale]) 
  REFERENCES [dbo].[Filiale] ([IDFiliale]) 
  ON UPDATE NO ACTION
  ON DELETE NO ACTION,
  ........................
)
ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO


CREATE TABLE [dbo].[RigheDocumenti] (
  [IDRigaDocumento]int IDENTITY(1, 1) NOT NULL,
  [IDDocumento]int NOT NULL,
............  
  CONSTRAINT [RigheDocumenti_PK] PRIMARY KEY CLUSTERED ([IDRigaDocumento]),
  CONSTRAINT [Documenti_RigheDocumenti_FK1] FOREIGN KEY ([IDDocumento]) 
  REFERENCES [dbo].[Documenti] ([IDDocumento]) 
  ON UPDATE CASCADE
  ON DELETE CASCADE,
.............

)
ON [PRIMARY]
GO

CREATE TABLE [dbo].[MovimentiMagazzino] (
  [IDMovimentoMagazzino]int IDENTITY(1, 1) NOT NULL,
  [IDFiliale]int NOT NULL,
  [IDDocumento]int NULL,
.......
  CONSTRAINT [MovimentiMagazzino_PK] PRIMARY KEY CLUSTERED ([IDMovimentoMagazzino]),
  CONSTRAINT [Documenti_MovimentiMagazzino_FK1] FOREIGN KEY ([IDDocumento]) 
  REFERENCES [dbo].[Documenti] ([IDDocumento]) 
  ON UPDATE CASCADE
  ON DELETE NO ACTION,
.....  
  CONSTRAINT [Filiali_MovimentiMagazzino_FK1] FOREIGN KEY ([IDFiliale]) 
  REFERENCES [dbo].[Filiale] ([IDFiliale]) 
  ON UPDATE NO ACTION
  ON DELETE NO ACTION,

)
ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO


Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 08-Apr-2008 18:16:36   

braidiano wrote:

I explain flushed

In DB I have:

Documento table: IDDocumento (PK) ... IDFiliale (FK -> Filiale table) ...

MovimentoMagazzino table: IDMovimentoMagazzino (PK) .... IDDocumento (FK -> Documento table) IDFiliale (FK -> Filiale table) ....

RigheDocumento table: IDRigaDocumento (PK) IDocumento (FK -> Documento table) .....

in DocumentoManager, before saving it does this operations:




MovimentoMagazzinoEntity movimento;
foreach (RigaDocumentoEntity riga in doc.RigheDocumento)
{
      movimento = new MovimentoMagazzinoEntity(); 
      movimento.IDFiliale = doc.IDFiliale;
      ...........
      doc.MovimentoMagazzino.Add(movimento);
}

uow.AddForSave(doc,true);


where [b]doc[/b] is a DocumentoEntity instance.

At the point where movimento.IDFiliale = doc.IDFiliale is set, it's true that doc.IDFiliale has a value and is changed? As the exception shows that the FK field IDFiliale in doc is null (not saved)

I start debugging using runtime library source code ... so i noticed that when it builds the 2th INSERT INTO query of MovimentoMagazzinoEntity (because doc.MovimentoMagazzino.Count =2, and there was 2 entity to insert) when it executes the method:

protected virtual bool CheckIfFieldNeedsInsertAction(IEntityFieldCore field)

inside it field.IsChanged (when field.Name is "IDFiliale") becomes false.. So it skips the IDFiliale parameter during the second query building.

I find that hard to believe:


        /// <summary>
        /// Checks the if field needs insert action.
        /// </summary>
        /// <param name="field">Field.</param>
        /// <returns>true if the field needs to be included in the insert query. This is the case if the field is
        /// changed or not read only, or that it is linked to a supertype field (which indicates that the field will be receiving its value later)</returns>
        protected virtual bool CheckIfFieldNeedsInsertAction(IEntityFieldCore field)
        {
            // needs insert action when:
            // - field is changed
            // - field is not readonly
            // - field is linked to a supertype field
            // - field is a discriminator column
            return ( (!field.IsReadOnly && field.IsChanged) || (field.LinkedSuperTypeField!=null) || field.GetDiscriminatorColumnFlag());
        }

i.w.o. it doesn't change anything.

The field's IsChanged flag is set to false after the entity has been inserted (but that's after the insert was executed)

I think that this appens due to "foreach" that use the same "movimento" variable. Is this possible?

No that's not the problem. Please check if you set in the doc instance the Field mapped onto the relation Documento -> Filiale to an instance of Filiale.

Frans Bouma | Lead developer LLBLGen Pro
braidiano
User
Posts: 40
Joined: 18-Nov-2006
# Posted on: 08-Apr-2008 18:29:46   

At the point where movimento.IDFiliale = doc.IDFiliale is set, it's true that doc.IDFiliale has a value and is changed? As the exception shows that the FK field IDFiliale in doc is null (not saved)

yes, at this point both movimento.IDFiliale and doc.IDFiliale have a values (the same, and it is true)

I find that hard to believe: Code:

    /// <summary>
    /// Checks the if field needs insert action.
    /// </summary>
    /// <param name="field">Field.</param>
    /// <returns>true if the field needs to be included in the insert query. This is the case if the field is
    /// changed or not read only, or that it is linked to a supertype field (which indicates that the field will be receiving its value later)</returns>
    protected virtual bool CheckIfFieldNeedsInsertAction(IEntityFieldCore field)
    {
        // needs insert action when:
        // - field is changed
        // - field is not readonly
        // - field is linked to a supertype field
        // - field is a discriminator column
        return ( (!field.IsReadOnly && field.IsChanged) || (field.LinkedSuperTypeField!=null) || field.GetDiscriminatorColumnFlag());
    }

i.w.o. it doesn't change anything.

yes... it is hard but i assure you that CheckIfFieldNeedsInsertAction(...) returns false for IDFiliale (notice that this happens only on the 2th MovimentoMagazzinoEntity inserting).

the diagnostic trace:

(on the second INSERT query there aren't some parameters, because at runtime the IsChanged flag becomes false.. so they was skipped during query building.


Method Exit: CreateSelectDQ

Method Exit: CreatePagingSelectDQ: no paging.

Method Enter: DaoBase.ExecuteMultiRowDataTableRetrievalQuery(4)

Method Exit: DaoBase.ExecuteMultiRowDataTableRetrievalQuery(4)

Method Exit: DaoBase.PerformGetMultiAsDataTableAction(11)

Method Enter: DaoBase.AddNew

Method Enter: CreateInsertDQ

Method Enter: CreateSingleTargetInsertDQ

Generated Sql query: 

Query: INSERT INTO [dbo].[MovimentiMagazzino] ([IDAnnoContabile], [IDArticolo], [IDDeposito], [IDDocumento], [Data], [IDCausaleMovimentoMagazzino], [DescrizioneMovimento], [ValoreCarico], [UnitarioCarico], [QtaCarico], [QtaScarico], [ValoreScarico], [UnitarioScarico], [IDUtente], [IDFiliale]) VALUES (@IdannoContabile, @Idarticolo, @Iddeposito, @Iddocumento, @Data, @IdcausaleMovimentoMagazzino, @DescrizioneMovimento, @ValoreCarico, @UnitarioCarico, @QtaCarico, @QtaScarico, @ValoreScarico, @UnitarioScarico, @Idutente, @Idfiliale);SELECT @IdmovimentoMagazzino=SCOPE_IDENTITY()

Parameter: @IdmovimentoMagazzino : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Output. Value: <undefined value>.

Parameter: @IdannoContabile : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 2.

Parameter: @Idarticolo : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 33298.

Parameter: @Iddeposito : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 4.

Parameter: @Iddocumento : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 150.

Parameter: @Data : DateTime. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 08/04/2008 16.35.18.

Parameter: @IdcausaleMovimentoMagazzino : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 13.

Parameter: @DescrizioneMovimento : AnsiString. Length: 2147483647. Precision: 0. Scale: 0. Direction: Input. Value: "SCARICO: Fattura Vendita Immediata n.33/SW del 08/04/2008".

Parameter: @ValoreCarico : Currency. Length: 0. Precision: 19. Scale: 4. Direction: Input. Value: 0.

Parameter: @UnitarioCarico : Decimal. Length: 0. Precision: 12. Scale: 2. Direction: Input. Value: 0.

Parameter: @QtaCarico : Decimal. Length: 0. Precision: 12. Scale: 2. Direction: Input. Value: 0.

Parameter: @QtaScarico : Decimal. Length: 0. Precision: 10. Scale: 2. Direction: Input. Value: 50000.

Parameter: @ValoreScarico : Currency. Length: 0. Precision: 19. Scale: 4. Direction: Input. Value: 2250000,0000.

Parameter: @UnitarioScarico : Currency. Length: 0. Precision: 19. Scale: 4. Direction: Input. Value: 45,0000.

Parameter: @Idutente : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 1.

Parameter: @Idfiliale : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 7.


Method Exit: CreateSingleTargetInsertDQ

Method Exit: CreateInsertDQ

Method Enter: DaoBase.ExecuteActionQuery

The thread 0x151c has exited with code 0 (0x0).

The thread '<No Name>' (0x1528) has exited with code 0 (0x0).

Method Enter: Query.ReflectOutputValuesInRelatedFields

Method Exit: Query.ReflectOutputValuesInRelatedFields

Method Exit: DaoBase.ExecuteActionQuery

Method Exit: DaoBase.AddNew

Method Enter: DaoBase.AddNew

Method Enter: CreateInsertDQ

Method Enter: CreateSingleTargetInsertDQ

Generated Sql query: 

Query: INSERT INTO [dbo].[MovimentiMagazzino] ([IDAnnoContabile], [IDArticolo], [IDDeposito], [IDDocumento], [Data], [IDCausaleMovimentoMagazzino]) VALUES (@IdannoContabile, @Idarticolo, @Iddeposito, @Iddocumento, @Data, @IdcausaleMovimentoMagazzino);SELECT @IdmovimentoMagazzino=SCOPE_IDENTITY()

Parameter: @IdmovimentoMagazzino : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Output. Value: <undefined value>.

Parameter: @IdannoContabile : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 2.

Parameter: @Idarticolo : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 33298.

Parameter: @Iddeposito : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 4.

Parameter: @Iddocumento : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 150.

Parameter: @Data : DateTime. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 08/04/2008 16.35.18.

Parameter: @IdcausaleMovimentoMagazzino : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 13.


Method Exit: CreateSingleTargetInsertDQ

Method Exit: CreateInsertDQ

Method Enter: DaoBase.ExecuteActionQuery

A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll

A first chance exception of type 'SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException' occurred in SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll

Method Enter: TransactionBase.Rollback

Method Exit: TransactionBase.Rollback

A first chance exception of type 'SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException' occurred in SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll

Method Exit: UnitOfWork.Commit(2)

A first chance exception of type 'SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException' occurred in Genio.exe





Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 09-Apr-2008 11:14:53   

Would using the following makes a difference?

foreach (RigaDocumentoEntity riga in doc.RigheDocumento)
{
     MovimentoMagazzinoEntity movimento = new MovimentoMagazzinoEntity(); 
     movimento.IDFiliale = doc.IDFiliale;
     ...........
     doc.MovimentoMagazzino.Add(movimento);
}

uow.AddForSave(doc,true);