Hello,
I've created a simple project to study the new features of Entity Framework 4.1 Code First mainly the automatic database creation.
When the application is performed, if the database doesn't exists, the entity Framewrok creates new one. After that, the application try to create an new entity and try to persist on the database using SaveChanges() method. At this moment, some
times I get the message:
Cannot open database "database_name" requested by the login. The login failed. Login failed for user 'domain_name\user_name'
I've changed the code to wait four seconds after creation of database using the following line:
System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 4))
after that, the new entity was stored on database! Why ?!
What can be wrong? Can't I create a new entity and call SaveChanges immediatly after database creation ?
Marcos