草庐IT

name-value

全部标签

c# - 无法添加类型为 'filter' 且唯一键属性 'name' 设置为 'ASP.Net_4.0_64bit' 的重复集合条目

我遇到这个问题已经有一段时间了。当我打开一个指向我的本地主机的asp.net页面时,就会发生这种情况。我正在运行带有visualstudio2012和iis7.5的Windows2008r2。它显示的配置源是这样的。:1451:1452:1453:它表明它在第1452行出错。最初,这是inetsrv32位和64位位置的applicationHost.config文件中的一个问题。我进去并删除了重复的4.0条目,它工作了好几个月。然后它又开始抛出这个错误。那时我刚刚完全重新安装了IIS,我的应用程序又开始工作了。此错误再次开始出现,我再次执行了IIS的完全重新安装,但这次没有帮助,我的应

c# - WebApi 服务中的 [FromUri] 属性忽略了 DataMember 的 Name 属性

我们正在使用Asp.NetWebApi创建RestService。但由于某种原因,当尝试使用[FromURI]属性反序列化复杂属性时,Name属性在DataMember属性中被忽略。例如我们可能有:方法:publicIHttpActionResultGet([FromUri]Useruser)型号:[DataContract]publicclassUser{[DataMember(Name="username")]publicstringUsername{get;set;}[DataMember(Name="isActive",IsRequired=false)]publicbool?

c# - "Assembly Same Simple Name already been imported"错误

这是一个CLR项目。我正在导入两个同名的DLL文件,quizz.dll(我将旧版本重命名为legacyquizz.dll),并将新版本包含为quizz.dll到遗留转换器测试项目。(正在测试的遗留转换器项目仅导入旧的quizz.dll)。这是我遇到的错误。..Anassemblywiththesamesimplename'Quizz,Version=2.0.0.1,Culture=neutral,PublicKeyToken=nullhasalreadybeenimported.Tryremovingoneofthereferencesorsignthemtoenableside-by

c# - 尝试打开 telerik 报告时出现 "Value cannot be null. Parameter name: instance"错误

在我的解决方案中,我有telerik报告,当尝试在VisualStudio2010设计器中打开它们时,我收到此错误:Valuecannotbenull.Parametername:instanceCallStackatSystem.ComponentModel.TypeDescriptor.AddAttributes(Objectinstance,Attribute[]attributes)atMicrosoft.VisualStudio.Design.VSDesignSurface.CreateDesigner(IComponentcomponent,BooleanrootDesig

c# - 是否有任何有值(value)的 CSLA 替代品可用?

我的公司有兴趣将大型业务应用程序移植到.NET。我们计划开发桌面版和silverlight版。我主要研究了CSLA框架(得到了rocky的书,已经读了一半)并发现它有点过度设计,数据层方面似乎也没有那么完善。有没有其他框架声称可以做CSLA正​​在做的事情?我不是在谈论ORM工具(例如L2S、EF、NHibernate)。我感兴趣的是支持业务规则的框架、简单的n层架构、对象是域驱动的而不是数据库驱动的、业务对象的安全性等...我知道我可以找到小型框架来完成一些所需的工作(我想到了EnterpriseApplicationBlock),但我正在寻找一个包含所有内容的框架。

c# - ASP.net Web API : change class name when serializing

我有一个产品的数据传输对象类publicclassProductDTO{publicGuidId{get;set;}publicstringName{get;set;}//Otherproperties}当Asp.net序列化JSON(使用JSON.NET)或XML中的对象时,它会生成ProductDTO对象。但是,我想在序列化期间更改名称,从ProductDTO到Product,使用某种属性:[Name("Product")]publicclassProductDTO{[Name("ProductId")]publicGuidId{get;set;}publicstringName{

C# 反射 : how to get an array values & length?

FieldInfo[]fields=typeof(MyDictionary).GetFields();MyDictionary是一个静态类,所有字段都是字符串数组。如何获取每个数组的长度值,然后遍历所有元素?我尝试了这样的类型转换:fieldasArray但它会导致错误Cannotconverttype'System.Reflection.FieldInfo'to'System.Array'viaareferenceconversion,boxingconversion,unboxingconversion,wrappingconversion,ornulltypeconversion

c# - SQL 服务器 : invalid object name in query execution

我正在尝试执行Insert语句,但一直收到Invalidobjectname错误。这是我的代码:publicstringaddNewComment(intuserID,intpageID,stringtitle,stringcomment){stringquery="INSERTINTOdbo.nokernok_kommentarer(userID,pageID,commentTitle,comment)"+"VALUES("+userID+","+pageID+",'"+title+"','"+comment+"')";adapter.InsertCommand=newSqlComm

c# - Resharper 中的警告 "Return value of pure method is not used"

我有一个快速的问题,关于我正在工作的c#项目中从VisualStudio中的Resharper收到的警告。警告是:"ReturnValueofpuremethodisnotused"发生这种情况的方法如下:privatestaticboolFilePathHasInvalidChars(stringuserInputPath){try{//thisiswherethewarningoccurs:Path.GetFullPath(userInputPath);}catch(Exceptione){Log.Error(String.Format("TheProgramfailedtorun

c# - 如何将对象集合/字典序列化为 <key>value</key>

有没有办法将键/值对(最好是强类型,但也可能来自字典)序列化为下面所需的格式?publicListIdentifiers=newList();publicclassIdentifier{publicstringName{get;set;}publicstringDescription{get;set;}}这通常会序列化为以下内容:somenamesomedescription...我们考虑的另一种可能的方法是使用哈希表/字典:publicDictionaryIdentifiers=newDictionary{{"somename","somedescription"},{"anothe