草庐IT

project-settings

全部标签

c# - AutoMapper Project().To() 并对子集合进行排序

我有一个对象图,我正在使用EFCodeFirst和AutoMapper从数据库加载到DTO:-publicclassFoo{publicintId{get;set;}publicvirtualICollectionBars{get;set;}}publicclassBar{publicintId{get;set;}publicintFooId{get;set;}publicvirtualFooFoo{get;set;}publicstringName{get;set;}publicintSortOrder{get;set;}}publicclassFooDto{publicIEnume

c# - ASP.NET MVC : Problem setting the Authorize attribute Role from a variable, 需要常量

我在设置变量的授权属性角色值时遇到问题。错误消息说它需要一个const变量。当我创建一个const类型变量时,它工作正常,但我试图从Web.Config文件或任何其他允许最终用户设置它的文件加载值。我正在使用集成的Windows身份验证,因为这是一个仅限Intranet的应用程序。有没有办法从Controller检查用户角色?我将在if语句中使用它而不是属性来进行身份验证。[Authorize(Roles=Config.GMPUser)]publicActionResultIndex(){returnView();} 最佳答案 我有

c# - ASP.NET 5 MVC6 错误 : project is not a web project

我从私有(private)git存储库克隆了一个现有的ASP.NET5MVC6项目。当我运行该项目时,我收到以下错误:选定的调试选项是IISExpress,但此项目不是Web项目。要使用IISExpress,您需要将wwwroot属性添加到project.json。wwwroot文件夹也没有正确显示,显示为普通文件夹。已安装VisualStudio2015-更新1 最佳答案 确保从http://get.asp.net安装asp.netrc1update1 关于c#-ASP.NET5MVC

c# - Properties.Settings.Default.Save(); ->那个文件在哪里

我有一个使用“设置”的应用。要保存我使用的设置:Properties.Settings.Default.Save();阅读我使用的:Properties.Settings.Default.MyCustomSetting;在我的应用程序文件夹中,我只有exe文件。没有配置文件。我的应用程序运行良好,可以读写设置。如果该文件不在应用程序文件夹中,该文件位于何处? 最佳答案 在我的WindowsXP机器上,设置保存在C:\DocumentsandSettings\\ApplicationData\下某处名为user.config的文件中。

c# - 为什么 EPPlus 告诉我 "Can' t set color when patterntype is not set"当我设置了 PatternType 时?

我有这段代码来尝试设置标题行的样式:worksheet.Cells["A32:D32"].Style.Font.Name="Georgia";worksheet.Cells["A32:D32"].Style.Font.Bold=true;worksheet.Cells["A32:D32"].Style.Font.Size=16;worksheet.Cells["A32:D32"].Style.Fill.PatternType=ExcelFillStyle.Solid;worksheet.Cells["A32:D33"].Style.Fill.BackgroundColor.SetCol

c# - 如何在设计时避免 XAML 代码中出现 "object reference not set to an instance of an object"异常?

我自己设计的wpf用户控件有问题。问题是,当我在我的程序中实现用户控件时,在设计时XAML代码中出现objectreferencenotsettoaninstanceofanobject异常。设计师向我展示了以下信息:atMicrosoft.Expression.Platform.InstanceBuilders.InstanceBuilderOperations.InstantiateType(Typetype,BooleansupportInternal)atMicrosoft.Expression.Platform.InstanceBuilders.ClrObjectInstan

C# 初学者学习 : To do a project without having read big concepts

关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭5年前。Improvethisquestion作为IT支持技术员工作了3年后,我决定改变领域并开始编程。我正在通过WroxBeginningVisualC#2008book学习C#,我将其用作指南。我已经阅读了整个POO部分(继承、多态性……委托(delegate)……)。我已经开始了第二部分,即Windows编程(Winforms)我知道你们中的很多人建议做一些工作应用程序来练习,但是如果我还没有开始使用SQLServer、LINQ

c# - 如何为数组数据成员定义 get 和 set?

我正在创建一个类Customer,它具有以下数据成员和属性:privatestringcustomerName;privatedouble[]totalPurchasesLastThreeDays;//arrayof3elementsthatwillholdthetotalsofhowmuchthecustomerpurchasedforthepastthreedaysi.e.element[0]=100,element[1]=50,element[2]=250publicstringCustomerName{get{returncustomerName;}set{customerNa

c# - System.StackOverflowException ,何时使用 get set 属性?

在wcfserviceLibrary.DLL中发生类型为“System.StackOverflowException”的未处理异常代码如下。[DataContract]publicclassmemberdesignations{[DataMember]publicstringDesigId{get{returnDesigId;}set{DesigId=value;}}[DataMember]publicstringDesignationName{get{returnDesignationName;}set{DesignationName=value;}}}然后我有如下的Typememb

c# - 将 set 访问器添加到类中的属性,该类派生自只有一个 get 访问器的抽象类

我有一个抽象类,AbsClass实现一个接口(interface),IClass.IClass有几个属性只有Get访问器。AbsClass实现的属性IClass作为要在派生自的类中定义的抽象属性AbsClass.所以所有派生自的类AbsClass还需要满足IClass通过与Get访问器具有相同的属性。但是,在某些情况下,我希望能够向来自的属性添加set访问器。IClass.然而,如果我尝试覆盖中的抽象属性AbsClass使用setaccessor我收到此错误ConcClassA.Bottom.Set无法覆盖,因为AbsClass.Bottom没有可覆盖的set访问器见ConcClass