草庐IT

y_opened_the_database_device_lock

全部标签

c# - 在 Database First 中更改实体和属性名称

我正在启动一个新应用程序,该应用程序必须使用现有数据库,该数据库使用一些在.net中非常烦人的命名约定(表名以指定表的业务域的几个三元组开头,列名以表开头八卦,三卦都是大写的,用下划线等分隔,)。我想做的是编写一个简单的重命名规则(这就像找到最后一个下划线并获取后面的所有内容一样简单)并将其应用到EntityFramework中。我真的不想在编辑器中一个一个地编辑名字,尤其是因为数据库可能会改变,我不想重复多次。我正在使用DatabaseFirst(因为数据库已经存在并且它是“主数据库”)和EF4.xDbContextGenerator,它开箱即用(尽管类和属性的命名很糟糕)。我编辑了

c# - 错误 : ExecuteReader requires an open and available Connection. 连接的当前状态为打开

我有下面带有DataHelperClass的mvc4网站来执行查询。我的问题有时是,网站以异常为标题。我使用block来处理SqlCommand和SqlDataAdapter但没有成功。请帮助我,对不起我的英语。try{if(_conn.State==ConnectionState.Closed)_conn.Open();using(SqlCommandsqlCommand=newSqlCommand(query,_conn)){sqlCommand.CommandType=CommandType.StoredProcedure;if(parameters!=null)sqlComma

c# - "The breakpoint will not currently be hit. A copy of file was found in dll file, but the current source code is different"

我不断收到此错误消息,提示存在.cs文件的副本,因此不会命中断点。我尝试过清理解决方案、重建、删除obj和bin文件夹中的.pdb文件、关闭VS并重新启动它、重新启动整个机器(这是Windows!有时最复杂、无法解释的问题会像这样解决:\)知道我还能尝试什么吗?这是VS2015上的.net项目 最佳答案 我发现了问题,原来IIS配置为使用我备份文件夹中项目的不同副本。这听起来很傻,但如果有人有类似的问题,我会保留这个问题。 关于c#-"Thebreakpointwillnotcurren

c# - NHibernate - KeyNotFoundException : The given key was not present in the dictionary

更新:我已经解决了这个问题我有下面的代码块,它最终应该更新一条记录if(session.Contains(entity)){session.Evict(entity);}Session.Evict(entity)上的哪些错误带有KeyNotFoundException,以及以下消息:Thegivenkeywasnotpresentinthedictionary.我是不是误会了什么?我假设如果session.Contains(entity)为真,那么key应该存在,因此session.Evict()应该按预期工作?堆栈轨迹如下:System.Collections.Generic.Key

c# - Visual Studio 变得疯狂 : 'The directory name is invalid' error when trying to compile

出于一些非常奇怪的原因,我的VisualStudio2008在尝试编译C#项目时尝试将可执行文件的输出写入与可执行文件同名的目录,至少看起来这就是错误所在消息暗示。在我的任何项目上运行编译后,CSC.EXE报告以下编译器错误:Couldnotwritetooutputfile'D:\Projects\Examples\StringBuilderVsString\obj\Release\StringBuilderVsString.exe'--'Thedirectorynameisinvalid.'当我查看obj\Release或obj\Debug时,所有中间资源(如StringBuild

c# - EntityFramework 测试初始化​​错误 : CREATE DATABASE statement not allowed within multi-statement transaction

我正在尝试构建一个快速测试,每次运行时都会删除并重新创建数据库。我有以下内容:[TestClass]publicclassPocoTest{privateTransactionScope_transactionScope;privateProjectDataSource_dataSource;privateRepository_repository=newRepository();privateconststring_cstring="DataSource=.;InitialCatalog=test_db;Trusted_Connection=True";[TestInitialize

c# - "Both use the XML type name X, use XML attributes to specify a unique XML name and/or namespace for the type"怎么解决?

我有以下枚举定义...namespaceItemTable{publicenumDisplayMode{Tiles,Default}}namespaceEffectiveItemPermissionTable{publicenumDisplayMode{Tree,FullPaths}}...然后我有以下类(class)...publicclassTablewhereTDisplayMode:struct{//publicpublicTDisplayModeDisplayMode{get{returnmDisplayMode;}set{mDisplayMode=value;}}//pri

c# - Facebook 登录抛出“应用程序配置不允许给定的 URL。: One or more of the given URLs is not allowed

我知道这个问题已经被问过很多次了,但是尽管我尝试了几个url地址,它似乎仍然会抛出这个错误。我正在尝试像微软教程中那样通过asp.netmvc应用程序登录facebookhere.当我在本地主机上检查它时它工作正常(Facebook中的站点URL设置为:http://localhost:55797/但是当我将应用程序上传到服务器后尝试检查它时,它给了我这个错误:GivenURLisnotallowedbytheApplicationconfiguration.:OneormoreofthegivenURLsisnotallowedbytheApp'ssettings.Itmustmat

c# - JWT 错误 IDX10634 : Unable to create the SignatureProvider C#

我正在尝试运行我的应用程序,但它因以下错误而卡住:System.NotSupportedExceptionHResult=0x80131515Message=IDX10634:UnabletocreatetheSignatureProvider.Algorithm:'[PIIishiddenbydefault.Setthe'ShowPII'flaginIdentityModelEventSource.cstotruetorevealit.]',SecurityKey:'[PIIishiddenbydefault.Setthe'ShowPII'flaginIdentityModelEve

c# - 错误 : The object cannot be deleted because it was not found in the ObjectStateManager

试图在这里处理EntityFramework,但我遇到了一些减速带......我有一个Get()方法可以正常工作并且已经过测试,但是我的Delete方法不起作用:publicstaticvoidDelete(stringname){J1Entitiesdb=newJ1Entities();db.DeleteObject(Get(name));db.SaveChanges();}但是我收到以下错误:错误:无法删除该对象,因为在ObjectStateManager中找不到它。我运行了调试器,DeleteObject中的对象是正确的...我错过了什么?谢谢。 最佳