Hi,
I have a Customers table in my database with a corresponding ExpectedAddress es table that holds expected addresses of each Customer. Rows of later table are constant for each instance of database which enables me to have different variety of addresses for different databases. In addition, I have also a CustomerAddress es table which is child of aforementioned tables and holds all expected addresses for each Customer.
With this logic, when I want to add a new Customer, I should add as many rows as ExpectedAddress es has, to CustomerAddress es field of new Customer. How can I do this in Linq to SQL?
I tried OnCreated method, but it is fired whenever a new instance of customer (not only new ones) is created.
I have a Customers table in my database with a corresponding ExpectedAddress es table that holds expected addresses of each Customer. Rows of later table are constant for each instance of database which enables me to have different variety of addresses for different databases. In addition, I have also a CustomerAddress es table which is child of aforementioned tables and holds all expected addresses for each Customer.
With this logic, when I want to add a new Customer, I should add as many rows as ExpectedAddress es has, to CustomerAddress es field of new Customer. How can I do this in Linq to SQL?
I tried OnCreated method, but it is fired whenever a new instance of customer (not only new ones) is created.