Hi guys.
I have 2 tables. Let's say
1. Orders
title
date
customer_username
2. Customers
username (primary key)
name
lastname
It can be seen that I have a foreign key relationship between these two tables. I have one entity called orderEntity.
Each time when I try to save any order
using (var adapter = new DataAccessAdapter())
{
adapter.SaveEntity(orderEntity);
}
LLBLGen adds one new record to Customers table too without checking whether this username already exists in Customers table. As far as username field of Customers table is primary key for Customers table when adding first time a new customer there is no problem but when saving second order for the same customer application raises exception saying "foreign key constraint conflict"
Is it possible to avoid adding new customer each time when I add new orderEntity.
I would like to check whether customer with the given username exists or not if exists I would like to update rather insert if does not exist then no problem to insert.
I hope I was clear with my bad enlish. Any help greatly appreciated.