EDMX填充MDF? [英] edmx populating mdf?

查看:260
本文介绍了EDMX填充MDF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在EDMX文件'生成模型数据库它要求一个数据源,并生成一个sql文件并添加数据源在app.config

when i 'generate database from model' in an edmx file it asks for a datasource and generates a sql file and adds the data source to the app.config

如果我选择SQLSERVER作为源它工作正常,我可以使用现有的数据库或创建一个新的,表获取填充它和它准备使用

if i choose sqlserver as the source it works fine and i can either use an existing database or create a new one and the tables get populated to it and its ready to use

可能使该SQL填充新的MDF文件不知何故?

possible to make that sql populate a new mdf file somehow?

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 08/25/2010 10:41:33
-- Generated from EDMX file: c:\test\test.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [test];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

...

针对工作sqlserver的罚款,但抱怨当我连接到sqlex preSS和填充项目目录本地mdf文件未找到数据库?

works fine against sqlserver but complains database not found when i connect to sqlexpress and to to populate a local mdf file in the project dir?

我要让它使用连接字符串从某种程度上的app.config?或者先在SQL管理数据库?或以某种方式修改生成的SQL(我的创造中密度纤维板的路径可能)?

i have to make it use the connection string from the app.config somehow? or create the database in sql manager first? or modify the generated sql somehow (with the path of my created mdf maybe)?

非常感谢

推荐答案

我试图通过右键单击在解决当地密度纤维板运行这样的查询,选择新建查询。我不得不删除了使用[测试],并在查询文本所有的GO的,它正确生成我的表。

I tried running a query like this by right clicking on the local .mdf in the solution and choosing "New Query". I had to remove the "use [test]" and all the "GO"'s in the query text and it generated my tables correctly.

这篇关于EDMX填充MDF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆