tags:

views:

68

answers:

4

I have a SQL Express 2008 DB that has gone live. I'd like to create a new table in that database without deleting all the existing data in the live DB. I created an entity class for the new table and a separate data-context.

What is the best way for me to add the new table using LINQ to SQL

Thanks...

A: 

Why not just execute the SQL statement, like create table [mytable] ...?

giorgian
I was hoping that there was an easy way to create the table as Linq to SQl will use the class Metadata to create the tables if you use the DataContext.CreateDatabase() method. But that doesn't work on an existing database
Redshirt
A: 

Why you add unmapped-entities to diagram? I think, first you have to create tables after map entities.

cem
A: 

In the new Linq to Entity which shipped with Visual Studio 2010 there is easy way to create Database table from Model you built.

here is the Example : Create a Database using Model-First

Wahid Bitar
A: 

That's not Linq To Sql's role in your architecture. You need to create the tables prior to deploying your new version of your data model.

You can either manually update your db w/ direct SQL commands against it, or you can package it w/ the deployment (e.g. via continuous integration scripts or something like Migrator.NET)

Paul
Direct SQL commands were what I ended up going with. Thanks for the reply (Not enough rep to upvote your answer)
Redshirt