Dear All, I have a big problem cause some times when change structure of the entity the DataObjects.Net throw exception and working only when use Recreate option!!!!, and also some times after using my site in heavy use it don't work until using recreate!!!!. Why???? Please anybody help me

asked May 16 '11 at 03:20

Hala%20Aly's gravatar image

Hala Aly
7779

Hello Hala,

in order to help you with the upgrade, I need both versions of your model: the original one and the model with changed structure. Having that I could try reproducing the failing upgrade scenario and possibly fix the upgrade routine or give advice on upgrade hints application.

(May 16 '11 at 04:46) Dmitri Maximov Dmitri%20Maximov's gravatar image

One Answer:

Dear Dmitri, this the error dispalyed in my application until I take permission from my company to send you the code.

Server Error in '/Rawabi' Application.

The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_LinkUOM-UOMLink-UOM_UOMLink". The conflict occurred in database "CompanyDB", table "dbo.UOM", column 'Id'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_LinkUOM-UOMLink-UOM_UOMLink". The conflict occurred in database "CompanyDB", table "dbo.UOM", column 'Id'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_LinkUOM-UOMLink-UOM_UOMLink". The conflict occurred in database "CompanyDB", table "dbo.UOM", column 'Id'.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +404 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +412 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1363 System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) +2840828 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +504 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +327 Xtensive.Storage.Providers.Sql.Driver.ExecuteNonQuery(Session session, DbCommand command) +66

[ReferentialConstraintViolationException: Error 'ReferentialConstraintViolation' while executing query 'UPDATE [dbo].[JournalEntryTemplete] SET [LocalCurrency.Id] = (CASE WHEN ([JournalEntryTemplete].[TempLocalCurrency.Id] IS NULL) THEN '00000000-0000-0000-0000-000000000000' WHEN ([JournalEntryTemplete].[TempLocalCurrency.Id] IS NOT NULL) THEN CAST([JournalEntryTemplete].[TempLocalCurrency.Id] AS uniqueidentifier) END); CREATE INDEX [JournalEntryTemplete.FK_FiscalCalendar] ON [dbo].[JournalEntryTemplete] ([FiscalCalendar.Id] ASC); CREATE INDEX [JournalEntryTemplete.FK_LocalCurrency] ON [dbo].[JournalEntryTemplete] ([LocalCurrency.Id] ASC); ALTER TABLE [dbo].[LinkUOM] ADD CONSTRAINT [FK_LinkUOM-UOMLink-UOM_UOMLink] FOREIGN KEY ([UOMLink.Id]) REFERENCES [dbo].[UOM] ([Id]); ALTER TABLE [dbo].[LinkUOM] ADD CONSTRAINT [FK_LinkUOM-MasterUOM-UOM_MasterUOM] FOREIGN KEY ([MasterUOM.Id]) REFERENCES [dbo].[UOM] ([Id]); ALTER TABLE [dbo].[JournalEntryTemplete] ADD CONSTRAINT [FK_JournalEntryTemplete-FiscalCalendar-FiscalCalendar_FiscalCalendar] FOREIGN KEY ([FiscalCalendar.Id]) REFERENCES [dbo].[FiscalCalendar] ([Id]); ALTER TABLE [dbo].[JournalEntryTemplete] ADD CONSTRAINT [FK_JournalEntryTemplete-LocalCurrency-Currency_LocalCurrency] FOREIGN KEY ([LocalCurrency.Id]) REFERENCES [dbo].[Currency] ([Id]);'. Original message: The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_LinkUOM-UOMLink-UOM_UOMLink". The conflict occurred in database "CompanyDB", table "dbo.UOM", column 'Id'.] Xtensive.Storage.Providers.Sql.Driver.ExecuteNonQuery(Session session, DbCommand command) +138 Xtensive.Storage.Providers.Sql.SchemaUpgradeHandler.Execute(IEnumerable`1 batch) +270 Xtensive.Storage.Providers.Sql.SchemaUpgradeHandler.UpgradeSchema(ActionSequence upgradeActions, StorageInfo sourceSchema, StorageInfo targetSchema) +906 Xtensive.Orm.Building.Builders.DomainBuilder.SynchronizeSchema(SchemaUpgradeMode schemaUpgradeMode) +1439 Xtensive.Orm.Building.Builders.DomainBuilder.BuildDomain(DomainConfiguration configuration, DomainBuilderConfiguration builderConfiguration) +542 Xtensive.Orm.Upgrade.UpgradingDomainBuilder.BuildStageDomain(UpgradeStage stage) +339 Xtensive.Orm.Upgrade.UpgradingDomainBuilder.Build(DomainConfiguration configuration) +206 Microtech.Andalus.Business.DomainManager.BuildCompany() in D:\Hala\AndalusNew\Framework\trunk\Microtech.Andalus.Business\Core\DomainManager.cs:41 Xtensive.Practices.Web.SessionManager.EnsureDomainIsBuilt() +143 Xtensive.Practices.Web.SessionManager.ProvideSession() +60 Xtensive.Practices.Web.SessionManager.EnsureSessionIsProvided() +148 Xtensive.Practices.Web.SessionManager.get_Session() +16 Xtensive.Orm.Session.get_Current() +98 Microtech.Andalus.Business.DomainManager.StoreLastSession() in D:\Hala\AndalusNew\Framework\trunk\Microtech.Andalus.Business\Core\DomainManager.cs:155 Microtech.Andalus.Business.DomainManager.DemandMasterSession() in D:\Hala\AndalusNew\Framework\trunk\Microtech.Andalus.Business\Core\DomainManager.cs:66 Microtech.Infinity5.Web.Security.Login.Page_Load(Object sender, EventArgs e) in D:\Hala\Infinity5-Last\trunk\Source Code\Microtech.Infinity5.Web\Security\Login.aspx.cs:19 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25 System.Web.UI.Control.LoadRecursive() +71 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3048


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

answered May 17 '11 at 02:56

Hala%20Aly's gravatar image

Hala Aly
7779

Hala,

As far as I could understand from the exception, there was an attempt to create a reference from LinkUOM to UOM class, which failed because SqlServer couldn't create an appropriate foreign key between corresponding tables. This means that in table LinkUOM might be one or more rows that reference rows from UOM table that are actually absent.

Could you check this hypothesis out?

(May 17 '11 at 10:26) Dmitri Maximov Dmitri%20Maximov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×7
×2

Asked: May 16 '11 at 03:20

Seen: 1,780 times

Last updated: May 17 '11 at 10:26

powered by OSQA