RSolberg
RSolberg

Reputation: 26972

How to create SQL Database from Linq2Sql Model

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?

Upvotes: 6

Views: 966

Answers (3)

Adriaan Stander
Adriaan Stander

Reputation: 166326

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();

Upvotes: 6

masoud ramezani
masoud ramezani

Reputation: 22920

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;
}

Upvotes: 0

Geoff Appleford
Geoff Appleford

Reputation: 18832

I have not used this but I believe huagati can do this.

http://www.huagati.com/dbmltools/

Upvotes: 1

Related Questions