I have lost SQL Server 2008 database, I need to the database structure back from LINQ schema
My SQL Server 2008 server database for one of my new projects has deleted accidentally. What I'm left with is LINQ to SQL sche开发者_如何转开发ma file (DataContext schema and classes) and with hope to get my database structure back from this.
Is there a way?
For simple schema you can just call dataContext.CreateDatabase() - however it would be ambitious to hope for this to handle everything. I suspect you may have to accept the loss and (sadly) learn about the value of backups.
See MSDN for more on CreateDatabase:
http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.createdatabase.aspx
DataContext.CreateDatabase
Watch out for missing indexes, lookup data, etc.
精彩评论