Hi,
I have two databases with the same schema and name, which reside on two different servers, when I attempt to load an entity from the first database and save it to the second database (without make any changes in entity) the operation fails (the entity is not saved).
However, if I make some changes in this entity then all will be ok (the entity is saved).
This is an example:
DbUtils.ActualConnectionString=”"data source=database1…; initial catalog= dbname;..”;
……..
//load an entity from first database
CustomerEntity customer = new CustomerEntity(3131);
DbUtils.ActualConnectionString=”data source=database2…..; initial catalog= dbname;……………….”;
Customer.Save(); //<-- fails
// if I make changes
customer.Address = "1, Bar drive";
customer.City = "Silicon Valey";
customer.CompanyName = "Foo Inc.";
customer.ContactName = "John Coder";
customer.ContactTitle = "Owner";
customer.Country = "USA";
customer.Fax = "(604)555-1233";
customer.Phone = "(604)555-1234";
customer.PostalCode = "90211";
customer.save() ; //<-- it’s ok
What’s wrong please?
Thank you in advance.