Is it possible to create a SQL DB from a Linq2Sql model? I managed to lose a DB for something I started building a year ago, but have the Linq2Sql model. If this is possible, what are the steps?
+4
A:
Are you looking for something like this
How to: Dynamically Create a Database (LINQ to SQL)
YourDataContext db = new YourDataContext ("C:\\YourDB.mdf");
db.CreateDatabase();
astander
2010-03-03 05:19:20
Sweet! I managed to completely skip over this earlier.
RSolberg
2010-03-03 05:29:20
Whoever just put a -1 on this should be kicked off of SO for life! This is totally the answer!
RSolberg
2010-03-03 05:31:15
I just added the code sample I used to get the MDF created... Thanks!
RSolberg
2010-03-03 05:35:38
A:
David B
2010-03-03 05:19:22
+1
A:
please see the below links :
http://www.perpetuumsoft.com/Product.aspx?lang=en&pid=55&tid=linqtosqlsynchronization
http://www.codeproject.com/KB/linq/LINQ_to_SQL_Database_Sync.aspx
http://msdn.microsoft.com/en-us/library/bb399420.aspx
from MSDN :
public class MyDVDs : DataContext
{
public Table<DVD> DVDs;
public MyDVDs(string connection) : base(connection) { }
}
[Table(Name = "DVDTable")]
public class DVD
{
[Column(IsPrimaryKey = true)]
public string Title;
[Column]
public string Rating;
}
masoud ramezani
2010-03-03 05:22:29