草庐IT

dependency-properties

全部标签

c# - Net Core : Execute All Dependency Injection in Xunit Test for AppService, 存储库等

我正在尝试在AppService的Xunit测试中实现依赖注入(inject)。理想的目标是运行原始应用程序Startup/configuration,并使用Startup中的任何依赖注入(inject),而不是在我的测试中再次重新初始化所有DI,这就是整个目标。更新:Mohsen的回答很接近。需要更新几个语法/需求错误才能工作。由于某种原因,原始应用程序可以运行并且可以调用部门应用程序服务。但是,它不能调用Xunit。最后使用原始应用程序的启动和配置让Testserver工作。现在收到以下错误:Message:Thefollowingconstructorparametersdidn

c# - MSBuild 未处理的异常 : The FileName property should not be a directory unless UseShellExecute is set

版本dotnet核心SDK:2.1.403docker:18.09.7Linux内核:5.0.0-27Ubuntu:18.04.3问题我正在docker中运行一个ASP.NETCore项目。当我docker-composeup时,我得到以下信息:UnhandledException:Microsoft.Build.BackEnd.NodeFailedToLaunchException:TheFileNamepropertyshouldnotbeadirectoryunlessUseShellExecuteisset.--->System.ComponentModel.Win32Exce

c# - 为什么我的数据绑定(bind)看到的是真实值而不是强制值?

我正在编写一个真正的NumericUpDown/Spinner控件作为学习自定义控件创作的练习。我已经得到了我正在寻找的大部分行为,包括适当的强制。然而,我的一项测试揭示了一个缺陷。我的控件有3个依赖属性:Value、MaximumValue和MinimumValue。我使用强制来确保Value保持在最小值和最大值之间,包括在内。例如://InNumericUpDown.cspublicstaticreadonlyDependencyPropertyValueProperty=DependencyProperty.Register("Value",typeof(int),typeof(

c# - Silverlight 中附加和非附加依赖属性之间的区别

好的,Stackers,我在这个问题上花了好几个小时,我想知道是否有人有明确的答案。对于我所做的所有研究,我无法在Silverlight中找到.Register和.RegisterAttached之间的任何区别。现在,在你马上告诉我.RegisterAttached用于将DP附加到另一个类之前,请尝试使用DependencyProperty.Register()实现附加的依赖属性。我没有发现任何区别,所以我不知道有什么区别。此外,在我的具体情况下,我试图扩展Grid类的功能,并希望为其提供一些额外的属性。因此,我尝试列出将typeof(Grid)和typeof(FluidLayoutM

c# - 如何解决 ReSharper 仅针对显示/值成员的属性的 "unused property"警告?

我已经为一个对象定义了两个属性,“Name”和“ID”,我将其用于具有BindingList数据源的ComboBox的DisplayMember和ValueMember。我最近安装了ReSharper来评估它。ReSharper在对象上向我发出警告,指出这两个属性未被使用。示例代码:BindingListSampleList=newBindingList();//populateSampleListcmbSampleSelector.DisplayMember="Name";cmdSampleSelector.ValueMember="ID";cmbSampleSelector.Dat

Cucumber extend reports的extent.properties配置

extent.reporter.spark.class=tech.grasshopper.reporters.ReporterAdapter$SparkReportAdapterextent.reporter.json.class=tech.grasshopper.reporters.ReporterAdapter$JsonReportAdapterextent.reporter.pdf.class=tech.grasshopper.reporters.ReporterAdapter$PDFReportAdapterextent.reporter.html.class=tech.grassho

c# - 来自字符串的 DependencyProperty

如何将属性名称(字符串形式)转换为DependencyProperty?我有一组属性名称、它的字符串值和一个DependencyObject。现在我想将这些属性值设置为DependencyObject。关于如何实现这一目标的任何想法?谢谢。 最佳答案 可以得到DependencyPropertyDescriptor使用DependencyPropertyDescriptor.FromName方法,然后从此描述符获取依赖属性标识符。vardescriptor=DependencyPropertyDescriptor.FromName(

c# - 多线程,Task.Run 错误 'The call is ambiguous between the following methods or properties'

当我尝试构建项目时,显示以下错误消息。Thecallisambiguousbetweenthefollowingmethodsorproperties:'System.Threading.Tasks.Task.Run(System.Action)'and'System.Threading.Tasks.Task.Run(System.Func)'我该如何解决这个问题?publicstaticclassMaintananceManager{privatestaticThreadSafeSocialMediaListPostList=newThreadSafeSocialMediaList(

c# - ASP.NET Core 浏览器链接 `Unable to get property ' 文件'`

在MicrosoftVirtualAcademy类(class)中'IntroductiontoASP.NETCore(formerlyASP.NET5)',视频3,在39:00,他们演示了BrowserLink如何在Edge的F12工具和VisualStudio之间同步代码选择。我还没有看到开箱即用的相同功能。我不知道是否有设置或特殊功能来启用此功能。如果有,它没有在类(class)视频中显示,但视频又是几个月前的了。我以前从未见过此功能。BrowserLink从Edge连接到VisualStudio,在VS中的BrowserLinkDashboard中可以看到。没关系。Edge中有

c# - DI Framework : how to avoid continually passing injected dependencies up the chain, 且未使用服务定位器(特别是使用 Ninject)

我需要更多帮助才能“了解”像Ninject这样的DI框架如何超越基础知识。以Ninject为例:classSamurai{privateIWeapon_weapon;[Inject]publicSamurai(IWeaponweapon){_weapon=weapon;}publicvoidAttack(stringtarget){_weapon.Hit(target);}}如果没有DI框架(即上面的[Inject]引用),引用类将类似于:classProgram{publicstaticvoidMain(){Samuraiwarrior1=newSamurai(newShuriken