Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints
Tech-Today

Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints


Have you encountered this error:

"Introducing FOREIGN KEY constraint 'x_y_Target' on table 'z_UsersInRoles' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints."

It appears when you have violated cascading referential constraints. A good example is the ff relationship:
aspnet_Applications->aspnet_Users->aspnet_UsersInRoles aspnet_Applications->aspnet_Roles->aspnet_UsersInRoles As you can see if you delete a single application it could delete the same aspnet_UsersInRoles record. The solution is to add the following code on OnModelCreating override:

modelBuilder.Entity().HasRequired(r => r.aspnetApplications).WithMany(a => a.aspnet_Roles).WillCascadeOnDelete(false);
We disable cascade delete on aspnet_Roles route, because by default cascade delete is on.




- How To Call Java Rest Web Service In Soapui
The following code is an explanation of how you can call a rest web service in java. Below you can find the actual java code and soapUI configuration. We enumerate 3 type of methods namely: POST, PUT and DELETE. How to call rest web service using soapUI...

- Avoid The Jsf Prerenderview On Crud Edit Mode
Long time ago I learned that the usual approach in CRUD is list, add, edit, delete. And right now I'm implementing the same thing in JavaEE6, Glassfish, JSF 2.1, Primefaces. So what I did was: 1.) Create a single backing bean that will handle all...

- Many To Many Relationship In Entity Framework
An example of many-to-many relationship is asp's membership tables, between aspnet_Users and aspnet_Roles. Usually we declare it like this: public class AspUser { public Guid UserId { get; set; } ... public ICollection AspRoles { get; set; } }...

- Executing A Linq Query With A Bridge Table Like Aspnet_users And Aspnet_roles
Using model first approach, we add aspnet_Users, aspnet_Roles and aspnet_UsersInRoles in the edmx file. But why is aspnet_UsersInRoles missing? It's because aspnet_Users has one-to-many relationship to aspnet_Roles. To get the role of the user, we...

- How To Use Entityframework Codefirst To Update Your Database
This tutorial will attempt to explain how to update an already existing database using EntityFramework's CodeFirst approach. We need: 1.) VS2010 SP1 2.) NuGet 3.) EntityFramework 4.1 4.) EntityFramework.Migrations   Steps: 1.) We need to make...



Tech-Today








.