I have two tables APP in two databases, I want to get the same App identifier in the two databases, but when I insert the app into the first database and insert it in the second database I have either a new Guid generated (if I specify a default value in my column) or a null guid.
here's my code of inserting the app in the two tables of the databases:
app.Id_App = Guid.NewGuid();
app.DateAdded = DateTime.Now;
app.PublisherId_advertiserPublisher = id_publisher;
db.AppSet.AddObject(app);
db.SaveChanges();
//add app to db2
App2 appDB2 = new App2()
{
App_link=app.App_link,
Id_app= app.Id_App,
CategoryId_cat=app.CategoryId_cat,
Description=app.Description,
keywords=keywords.Key_word,
};
DB2.App.AddObject(appDB2);
pushDB.SaveChanges();
I've already turned rowGuid
in table definition to no.
have I missed something? is there a better way to get the same guid key in two different databases?
thanks.