草庐IT

require_dependency

全部标签

c# - Ninject 和 MVC3 : Dependency injection to action filters

关于如何使用Ninject在ASP.NETMVC3中的ActionFilter上进行属性注入(inject),我发现了大量不确定的文章和问题。谁能给我一个明确的例子吗?这是我的自定义身份验证属性。publicclassCustomAuthorizeAttribute:AuthorizeAttribute{[Inject]publicIServiceService{get;set;}[Inject]publicIAuthenticationHelperAuthenticationHelper{get;set;}publicoverridevoidOnAuthorization(Autho

c# - 系统.IO.FileNotFoundException : Could not load file or assembly 'X' or one of its dependencies when deploying the application

我在部署应用程序时遇到了一个奇怪的问题,该应用程序引用了一个用托管C++编写的程序集。我创建了一个程序集X,对其进行编译并在名为Starter的exe文件中引用它。Starter.exe在本地机器上正常启动。但是,当我将启动器调试文件夹的所有内容复制到虚拟机器并尝试在那里启动它时,它崩溃并出现以下异常:UnhandledException:System.IO.FileNotFoundException:Couldnotloadfileorassembly'X'oroneofitsdependencies.Thespecifiedmodulecouldnotbefound.这对我来说没有

c# - 业务逻辑层和数据访问层 : circular dependency

我遇到了一点架构问题。在我的项目中,我有一个业务逻辑层(BLL),其中包含我所有的业务规则、模型和接口(interface)的OOAPI。每个对象都有像getById这样的静态方法,它返回所述对象的一个​​实例。每个对象还具有保存和删除等方法。这是非常简单的OO代码。现在我有一个数据访问层(DAL),包含在一个单独的命名空间中,对于每个BLL对象,我都有一个数据类或“存储库”,它执行getById和保存命令。所以在某种程度上,BLLsave和getById方法是DataClass方法周围的薄层。publicstaticNewsItemGetByID(intid){returnDataF

c# - Contract.Requires 抛出 pex 错误

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:HowDoYouConfigurePextoRespectCodeContracts?目前,当我运行pex探索时,我在我的类中创建的代码契约(Contract)在pex探索结果中被视为错误。我认为当您使用代码契约(Contract)运行pex探索时,契约(Contract)失败应被视为预期行为。这是导致异常的代码。测试方法:[PexMethod]publicvoidTestEquality(GuiduserId,stringusername,stringpassword,stringsecurityQuest

c# - 错误 : "an object reference is required for the non-static field, method or property..."

这个问题在这里已经有了答案:CS0120:Anobjectreferenceisrequiredforthenonstaticfield,method,orproperty'foo'(9个回答)关闭5年前。我正在用C#创建一个应用程序。它的功能是评估给定的是否为素数以及相同的交换数是否也是素数。当我在VisualStudio中构建我的解决方案时,它说“非静态字段、方法或属性需要对象引用...”。我在使用“volteado”和“siprimo”方法时遇到了这个问题。问题出在哪里,我该如何解决?namespaceConsoleApplication1{classProgram{static

c# - 如何修复 : The number of properties in the Dependent and Principal Roles in a relationship constraint must be identical?

我正在对SQLServer2012数据库使用EntityFramework4.3.1,并且我正在使用POCO方法。我收到以下错误,我想知道是否有人可以解释如何修复它:模型验证异常Oneormorevalidationerrorsweredetectedduringmodelgeneration:\tSystem.Data.Entity.Edm.EdmAssociationConstraint::ThenumberofpropertiesintheDependentandPrincipalRolesinarelationshipconstraintmustbeidentical.没有可用

dependency-injection - IoC和DI到底有什么区别

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:InversionofControl我总是在相同的上下文中阅读IoC(控制反转)和DI(依赖注入(inject))。IoC和DI到底有什么区别?IoC与DI有何不同?

c# - VS 2017 : The security debugging option is set but it requires the Visual Studio hosting process which is unavailable

我的解决方案(包含十几个项目)在VisualStudio2013中完美运行。在VisualStudio2017中,我可以打开解决方案并进行编译。但如果我开始调试,我会系统地收到此错误消息:ThesecuritydebuggingoptionissetbutitrequirestheVisualStudiohostingprocesswhichisunavailableinthisdebuggingconfiguration.Thesecuritydebuggingoptionwillbedisabled.Thisoptionmaybere-enabledintheSecuritypro

C# 错误 : "An object reference is required for the non-static field, method, or property"

我有两个类,一个用于定义算法参数,另一个用于实现算法:1类(算法参数):usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceVM_Placement{publicstaticclassAlgorithmParameters{publicstaticintpop_size=100;publicstaticdoublecrossover_rate=0.7;publicstaticdoublemutation_rate=0.001;publicstaticintchrom

c# - 为什么我会收到 411 Length required 错误?

这就是我使用.NET调用服务的方式:varrequestedURL="https://accounts.google.com/o/oauth2/token?code="+code+"&client_id="+client_id+"&client_secret="+client_secret+"&redirect_uri="+redirect_uri+"&grant_type=authorization_code";HttpWebRequestauthRequest=(HttpWebRequest)WebRequest.Create(requestedURL);authRequest.C