Changing the Order - Customer foreign key

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 лет назад
Hello,

I deleted the OrderCustomer FK in the database & created a new one on a nvarchar field.
The reason why I'm doing this is that I have to import old historical orders of which no customer exists.
Therefor I don't have a link to the customer table but I still want to fill the Customer object in my order if the user exists.

I am getting this error:
Order_Customer_Target_Order_Customer_Source: : The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property 'ClientNumber' on entity 'Order' does not match the type of property 'Id' on entity 'Customer' in the referential constraint 'Order_Customer'.

The foreign key I created links from Order.ClientNumber to Customer.ClientNumber so I don't get where the ID comes from.

Can anyone help me with this one? Thanks!
6 лет назад
pborgmans wrote:
Hello,

I deleted the OrderCustomer FK in the database & created a new one on a nvarchar field.
The reason why I'm doing this is that I have to import old historical orders of which no customer exists.
Therefor I don't have a link to the customer table but I still want to fill the Customer object in my order if the user exists.

I am getting this error:
Order_Customer_Target_Order_Customer_Source: : The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property 'ClientNumber' on entity 'Order' does not match the type of property 'Id' on entity 'Customer' in the referential constraint 'Order_Customer'.

The foreign key I created links from Order.ClientNumber to Customer.ClientNumber so I don't get where the ID comes from.

Can anyone help me with this one? Thanks!


Ok, first, restore your backup because you're going about it the wrong way.

If the customer doesn't exist, the order cannot be viewed so why import it? If it must be viewed by an admin, create a dummy customer and assign all the orders without customers to the dummy account.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.