【c# – ‘DNU RESTORE’如何确定依赖项是项目引用而不是包引用?】教程文章相关的互联网学习教程文章

c# – Spring.NET – 未将对象引用设置为对象的实例【代码】

我是.NET的新手.我之前在Java中使用过Spring Framework和Hibernate,但这是我在.NET中的第一次.为了开发我的应用程序,我使用Spring.Northwind解决方案作为示例. hibernate映射是:<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"><class name="EMSApplication.Domain.Employee, EMSApplication.Domain" table="ems_Employees" proxy="EMSApplication.Domain.IEmployee, EMSApplication.Domain" lazy="true"><id name="Id" t...

c# – 文件中的空引用【代码】

我在这一行得到了错误:String selectedValue = this.employeeList.SelectedValue.ToString();我得到的错误是NullReferenceException was unhandled. 这是什么意思?有人可以帮助我理解为什么我会收到此错误.下面是整个代码.String filePath = this.txtFilePath.Text; if (!String.IsNullOrEmpty(filePath)) {MessageBox.Show("No file path specified"); }if (this.employeeList.SelectedIndex != -1) {String selectedValue = th...

c# – .NET部署dll,项目不使用但引用的dll需要

所以问题很简单:我的项目引用程序集X而不是Z.但程序集X确实引用程序集Z.程序集Z更新一些频繁,所以每当我构建我的项目时,我也想获得最新版本的Z . 到目前为止,我已经提出了3个选项: >引用程序集Z.这具有始终获得新版本的优点.但它确实污染了参考文献,并没有严格要求.>添加一个后期构建事件,该事件从更新它们的位置复制所需的DLL.我认为这是非常好的,直到我需要多个不同的DLL,这将使脚本相当长并且维护繁琐.>将程序集Z添加为资源,并...

c# – 我是否需要在ASP.NET中部署Web服务引用?我可以使用单身人士吗?

我真的需要处理SoapHttpClientProtocol对象吗? 在ASP.Net中将实例用作Singleton是更好的做法吗? 这说SoapHttpClientProtocol是线程安全的:http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soaphttpclientprotocol.aspx.解决方法:它是线程安全的这一事实意味着将它用作单例将几乎将您的站点减少到单线程应用程序. 代理 – 特别是对于Web应用程序 – 应始终在使用块内创建为临时对象(尽管在WCF中它需要是...

C#实例拷贝/传递对象引用与Java不同?【代码】

class Player {private Location location;public Location getLocation(){return location;}public void setLocation(Location location){this.location = location;} }…class Location {int x,y,z;public Location(int x, int y, int z){this.x = x;this.y = y;this.z = z;}public Location(Location location){this.x = location.x;this.y = location.y;this.z = location.z;}public void updateLocation(Location location) /...

c# – MVC MusicStore Artist.Name对象引用未设置为对象的实例【代码】

通过MVC MusicStore学习MVC时,我的头脑开裂.详细信息视图页面的Model.Artist.Name出现此错误. 我的Storecontroller Details方法应该没问题.public ActionResult Details(int id){//returns and albums searched from the id var albums = storeDB.Albums.Find(id);return View(albums);}这就是我输出视图的方式<li>Price : <%=Model.Price %></li><li>Artist : <%=Model.Artist.Name%></li>价格合理,只显示Model.Genre.Name和Artis...

c# – NTAccount.Translate方法失败并显示错误无法转换部分或全部标识引用【代码】

PipeAccessRule par = new PipeAccessRule("Everyone", PipeAccessRights.ReadWrite, System.Security.AccessControl.AccessControlType.Allow);此代码失败并显示错误:Some or all identity references could not be translated.我想这是因为我在非英语本地启动我的应用程序时使用“Everyone”.在英语系统上一切都很好. 怎么避免这个?是否有一些enum描述了一般用户组? 堆栈跟踪:at System.Security.Principal.NTAccount.Transl...

c# – 清除对值和引用类型的疑虑【代码】

值类型变量直接包含实际数据,引用类型变量包含对实际数据的引用. 我认为这是: l.h.s是值类型,r.h.s是引用类型 在左侧,如果我将i复制到j,则新的存储位置填充相同的原始数据(45). 在右侧,如果我将k复制到l,则新的内存位置将填充对象的引用;这个引用指向内存中的实际对象. 现在,我对这种引用类型复制感到困惑.这里有一点不同的东西: 这里,r.h.s上的副本使l指向与k相同的位置. 我的问题是1.“哪一个更真实?”还是比我想象的更多? 此...

C#扩展方法重载导致“缺少程序集引用”错误【代码】

有一个相应的VS开发票https://connect.microsoft.com/VisualStudio/feedback/details/817276/error-cs0012-the-type-is-defined-in-an-assembly-that-is-not-referenced-issued-for-an-extension-method-that-is-not-used 我有2种扩展方法:public static class ExtensionMethods {public static string GetClientIpAddress(this HttpRequestBase request){// ...}public static string GetClientIpAddress(this HttpRequestMessag...

c# – 如何从XAML引用静态类字段【代码】

我有我的XAML引用的以下类:public static class SearchVariables {public static DataGridCellInfo current_cell_match;public static string current_cell_property;public static void setCurrentCell(Object dgi, DataGridColumn dgc, string property_name){current_cell_property = property_name;if (property_name == null){current_cell_match = new DataGridCellInfo();}else{current_cell_match = new DataGridCellInfo...

c# – LINQ表达式包含对与不同上下文关联的查询的引用【代码】

这是我的代码:var myStrings = (from x in db1.MyStrings.Where(x => homeStrings.Contains(x.Content))join y in db2.MyStaticStringTranslations on x.Id equals y.idselect new MyStringModel(){Id = x.Id,Original = x.Content,Translation = y.translation}).ToList();我得到的错误是指定的LINQ表达式包含对与不同上下文关联的查询的引用.我知道问题是我尝试从db1和db2访问表,但我该如何解决这个问题呢?解决方法:MyStrings ...

c# – 在调试器中观察值时的空引用异常【代码】

我正在重写我的类上的equals函数并且我得到一个零点异常,尽管我在调试器的“watch”部分输入相同的代码时没有异常. 这是我的代码(任何与==比较的字符串或基本类型):return this.workOrder == i.workOrder&& this.upi == i.upi&& this.testName == i.testName&& BasicFunctions.ArraysEqual(this.testTrays, i.testTrays)&& this.supplyVoltage == i.supplyVoltage&& this.supplyAmperage == i.supplyAmperage&& this.commandResul...

c# – 从.NET 4.5.1应用程序(EXE)引用.NET 3.5 DLL使用.NET 4.5.1对象【代码】

所以我有一个使用.NET 3.5编译的DLL.我目前正在调试此DLL中的以下行: 在VB.NET中:Dim result As IAsyncResult = CType(Cmd, SqlClient.SqlCommand).BeginExecuteNonQuery()或(在C#中)IAsyncResult result = (SqlClient.SqlCommand) Cmd.BeginExecuteNonQuery()我从.NET 4.5.1 Compiled .EXE引用此DLL,当我在VS调试器中查看上面代码中的“result”对象时,我看到:Id = 1, Status = WaitingForActivation {1}, Method = "{null}", ...

c# – ‘EntityFramework 6.1.3’已经安装.无法添加对’System.ComponentModel.DataAnnotations’的引用【代码】

我的winforms解决方案正在运行,但是当我重新打开它时,一些引用不再有效.因此,我删除了项目中的所有引用,包括对microsoft dll的引用. 现在我正在尝试添加引用.我该怎么办? 我尝试使用包管理器添加实体框架,但收到错误. 已经安装了’EntityFramework 6.1.3′.无法添加对“System.ComponentModel.DataAnnotations”的引用. 现在,当我打开包管理器,并选择On Line时,实体框架被勾选.但是,当我选择Installed Packages时,它会指出“当前解...

c# – 在Visual Studio 2013 Update 4中添加缺少STS引用

添加STS参考(最好添加创建新的STS项目)选项在Visual Studio Ultimate中没有更新4.我试图安装身份和访问工具扩展,它不允许我安装,因为它期待visual studio 2012 ultimate但不是2013年终极.我已经在这个以及他们讨论VS2012的每个地方引用了许多MSDN博客,或者他们谈论了WIF sdk 4.0的Fedutil工具,它使用旧版本的WIF(Microsoft.IdentityModel)而不是新版本(System.IdentityModel). 从创建项目,我可以使用“内部部署”选项以某种方式添加...