English 中文(简体)
Deploying my application that uses Entity Framework and creating databases on the client machine
原标题:

I created the model in Entity Framework, and then created the database from that model.

What would be the best way of doing this in the client machine?

If Entity Framework try to connect to the database and find the necessary tables and those do not exist, it will give an error.

What is the best way of create those tables in the client machine?

Using the SQL file generated by the model? If so, how can I execute it?

In case that matters, I m using SQL Server Express, although this question could be kind of generic for any database.

最佳回答

You can copy that script and use it in the client as well... I don t understand the problem of doing that.

This article has information on how to generate SQL script to generate DB.

http://www.dotnetcurry.com/ShowArticle.aspx?ID=606

It say to right-click the entity-designer, and then "Generate Database from Model...", after that you enter the information of the DB connection, click next and you have the SQL.

EDIT:

Information on how to read and execute an SQL file:

I found this one in microsoft forum:

http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/43e8bc3a-1132-453b-b950-09427e970f31/

This question here in SO:

How to execute an .SQL script file using c#

There is no native .Net way of doing that in a DB agnostic way I think.

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签