- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我得到的完整错误是这样的:
无法检查模型兼容性,因为数据库不包含模型元数据。确保已将 IncludeMetadataConvention 添加到 DbModelBuilder 约定中。
我已经在 SQL Server Compact 上尝试过这个,它工作正常,但托管提供商只支持专用服务器的 CE,我在共享计划中,所以我使用的是 SQL Server 2008。我在数据库中的连接字符串是采用以下格式:
<connectionStrings>
<add name="DBContext"
connectionString="Data Source=1.1.1.1;Initial Catalog=dbname;User Id=user;Password=pass;"
providerName="System.Data.SqlClient"/>
</connectionStrings>
我还有一个在 Application_Startup 中运行的 DatabaseInitializer。如果需要任何进一步的代码,请告诉我?我也没有创建 edmx 数据模型,我使用的是 EF Code First。
我更改了初始化代码总是删除数据库,但现在我收到错误消息,数据库“master”中的 CREATE DATABASE 权限被拒绝。我不知道为什么当我告诉它要使用的初始目录时会得到这个。
我现在将 null 传递给 SetInitializer,但现在我收到以下错误:
无法打开登录请求的数据库“dbname”。登录失败。用户“user”登录失败。
我仍在使用上面的连接字符串。
最佳答案
I changed the initializer code Drop the database always, but now I get the error, CREATE DATABASE permission denied in database 'master'. I don't know why I get this when I telling it the Initial Catalog to use.
您绝对不能在共享主机中这样做,因为您几乎没有直接创建数据库的权限。数据库只能在托管服务提供商的特殊界面中创建。 SQL Server 允许您删除您拥有的数据库,但是一旦您删除了它,您的权限就消失了,您不能在没有创建数据库的权限的情况下重新创建它(在共享主机中,您永远没有此权限)。
I am passing in null to the SetInitializer for now, but now I get the following error:
为时已晚。您的数据库已删除。您必须通过托管服务提供商界面创建它或联系您的托管服务提供商重新创建它。
I also have a DatabaseInitializer that runs in Application_Startup.
您不能在共享主机中使用任何内置的数据库初始化器,因为它们都希望创建数据库。您可以使用 custom initializer将表填充到现有数据库。
关于c# - SQL 服务器 2008 : Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8804960/
来自函数和方法参数的 PEP 8 部分: Always use self for the first argument to instance methods. Always use cls for
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题? Update the question所以它是on-topic对于堆栈溢出。 9年前关闭。 Improve this que
如标题所述,驼峰式大小写(即:theQuickBrownFox)如何在其中一个单词以小写字母开头后跟大写字母(如 iPhone 中的情况)时工作。 getiPhoneNumber() 例如看起来很奇怪
我正在寻找线程安全函数的命名约定,这意味着可以从多个线程安全地调用函数。但假设我使用: void FooThreadSafe(); 在您看来,您是否认为: 此函数将使用锁定机制,并发调用是否安全? 或
我正在查看来自多个开发人员的具有多种命名约定的代码 - 一种真正的享受。其中包括匈牙利语(“s_year”、“s_day”)以及其他风格(“yearS”、“dayS”)。 有谁知道这种风格叫什么?对于
function getPerformActionFunction(someParameter) { return function() { performAction(som
我正在做一个项目,遇到了以下命名问题。 我想实现工厂模式,但我不知道要使用的最佳类命名(我正在从一个更改为另一个,这非常耗时:S)。 我通常使用命名空间来分隔类组,但我的问题在于这段特定的代码: cl
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 6年前关闭。 Improve t
我想知道是否有任何甜蜜的语言为“英尺”与“英寸”或“厘米”等提供某种抽象。我正在考虑在 Java 中执行以下操作: u(56).feet() + u(26).inches() 并且能够得到类似的东西
最近,我一直在阅读Code Complete,这是基于这里的许多引用以及一位 friend 的引用,并且对社区有一个命名问题。应该在确定事件是否成功的 bool 方法上使用前缀"is"吗?这是我尝试过
当项目的名称已经是复数时,你如何命名你的数组? array names 是有道理的。array collisionDatas 没那么多。 最佳答案 我几乎总是将它命名为Item name + s。命名
我正在查看代码并在函数和方法名称的开头看到 %。例如 defun %rod 和 defmethod %do-query。是否有使用这种命名方案的标准约定? 最佳答案 来自few places : %f
您对应用程序域模型类和表示层类使用的命名约定是什么?后缀/前缀来区分类的目标和第一眼: 例如,从 DAL 返回的有关人员的信息可以是 public class PersonEntity { pub
我正在为 Assemble v0.6.0 创建一个 nunjucks 插件.它似乎正在使用 Template (我认为它以前被称为 Engine ),它也支持 Verb . 我应该调用插件“engin
对于某些对象将存在于两个版本中的情况,我需要提出一个命名方案。假设服务器端有 File 和 Directory 对象,它将这些对象的轻量级版本传递给客户端。 LightweightFile 和 Lig
好的,因此您可以阅读有关标识符命名的准则,“直到您脸色发青…… Camel 案,帕斯卡案,使它们具有描述性……”但它们实际上并不能帮助您为给定名称选择最佳名称应用程序域。 最容易选择的(IMHO)是一
我见过“The Coolest Server Names”,我还见过另一个 smaller-ish question与我的有关,不幸的是,它已关闭。 不过,这是一个严肃的问题,因为我在一个内部应用程序
问题是关于命名变量或标识符的正确方法,这些标识符将两个或多个“事物”的集合分组。让我用例子和问题进一步解释一下...... 如果你拥有一个 id,你可以用标识符“id”来命名它 如果你有一个包含约会的
作为一名初学者/中级开发人员,我遇到了一个问题,因为我的项目越来越大,越来越抽象,因为我使用了更多的 OOP 原则,我在命名事物时遇到了问题。就像当我有多个项目或类库时,我不知道如何命名它们。我看到了
我正在实现一个新的Web服务,并且在我尚未使用CQRS的同时,我想创建我的服务,以便将来可以轻松地将其移至CQRS。因此,我想知道DTO类和方法的命名约定。 我已经阅读了有关DTO命名约定的blog
我是一名优秀的程序员,十分优秀!