草庐IT

provider_class

全部标签

c# - ClickOnce 安装期间出现 FileNotFoundException,缺少 HKCU\Software\Classes\Software

我们的一位用户对ClickOnce有一个非常严重的问题。该错误是一个经典错误:Followingerrorsweredetectedduringthisoperation.*[14/10/201101:40:25]System.IO.FileNotFoundException-Thesystemcannotfindthefilespecified.(ExceptionfromHRESULT:0x80070002)-Source:System.Deployment-Stacktrace:atSystem.Deployment.Internal.Isolation.IsolationInt

c# - 使用 EF4(edmx 模型)时偶尔出现 "The underlying provider failed on Open"错误

我希望有人能帮我解决以下错误。发生错误的应用程序正在生产中运行,我自己从未遇到过错误。然而,我每天大约有20次收到错误邮件,告诉我:TheunderlyingproviderfailedonOpen.--->System.InvalidOperationException:Theconnectionwasnotclosed.Theconnection'scurrentstateisconnecting.这是堆栈跟踪System.Data.EntityException:TheunderlyingproviderfailedonOpen.--->System.InvalidOperati

c# - 为什么具有 T : class result in boxing? 约束的泛型方法

这个问题在这里已经有了答案:BoxingwhenusinggenericsinC#(2个答案)关闭3年前。为什么将T限制为类的泛型方法会在生成的MSIL代码中包含装箱指令?我对此感到非常惊讶,因为既然T被限制为引用类型,那么生成的代码应该不需要执行任何装箱。这是C#代码:protectedvoidSetRefProperty(refTpropertyBackingField,TnewValue)whereT:class{boolisDifferent=false;//forreferencetypes,weuseasimplereferenceequalitychecktodeterm

c# - T[].Contains for struct 和 class 表现不同

这是一个后续问题:List.ContainsandT[].ContainsbehavingdifferentlyT[].Contains当T时表现不同是类和结构。假设我有这个结构:publicstructAnimal:IEquatable{publicstringName{get;set;}publicboolEquals(Animalother)//在这里,通用Equals如我所料被正确调用。但是对于类:publicclassAnimal:IEquatable{publicstringName{get;set;}publicboolEquals(Animalother){return

c# - cocos2d-xna : sprite is not drawn if using instance of a class inherited from sprite

我有一个基于Cocos2DXNA和MonoGame的游戏项目。我想在CCSprite类中添加一些自定义逻辑,所以我创建了一个继承自CCSprite的类。我添加了一个虚拟自动属性并尝试使用此类,但出于某种原因,作为我的自定义Sprite类实例创建的Sprite未显示在图层上,而作为CCSprite类实例的Sprite完全没问题。代码如下所示:publicclassSprite:CCSprite{publicstringSomeProp{get;set;}}...line1:varmySprite1=newSprite("texture.png");line2:varmySprite1=n

c# - CA2104 警告 : Is there any way to mark a class as `Immutable` to suppress it?

考虑下面的代码,它触发了CA2104:Donotdeclarereadonlymutablereferencetypes.publicclassTest{//ThisprovokesCA2104:"Donotdeclarereadonlymutablereferencetypes".protectedreadonlyImmutableClassImmutableMember;}publicclassImmutableClass{}有谁知道以一种可以抑制警告CA2104的方式将类标记为不可变的方法吗?我尝试用[ImmutableObject(true)]装饰MutableClass没有成

c# - Facebook Connect 与使用 ASP.NET Membership Provider 的站点集成

是否有任何最佳实践或示例说明如何使用成员资格提供程序(或类似的东西)将Facebook连接与现有ASP.NET应用程序最佳集成。我确信我可以做一些事情,但是,如果有一些关于此的信息和最佳实践来减轻任何安全问题,那就太好了。目前我可以让用户“连接”并获取他们的信息,但是,我希望尽可能安全地处理它们,并尽可能与现有用户类似。特别是,我希望他们在“用户”表中有一个条目。对于与ASP.NETMVC相关的任何信息,这将非常有用。我迄今为止发现的一些有用的链接:http://facebooktoolkit.codeplex.com/Thread/View.aspx?ThreadId=45825Fa

c# - FileLoadException 在 InitializeComponent 或 x :Class=

我在InitializeComponent方法中遇到文件加载器异常(第一次机会),或者调试器在多个WPF的xaml-root的x:Class属性处中断用户控制。尽管异常会大大降低导航速度,但一切正常。这是异常信息:Couldnotloadfileorassembly'Company.Solution.UserInterface,Version=0.1.5568.25577,Culture=neutral,PublicKeyToken=45069ab0c15881ce'oroneofitsdependencies.Thelocatedassembly'smanifestdefinitio

c# - 为什么具有 "where T : class"约束的 Generic<T> 方法接受接口(interface)

我有这个interface:publicinterfaceITestInterface{intTestInt{get;set;}}和这个通用方法(带有T:class约束):publicvoidTest()whereT:class{//DoSomething}这个电话:Test();一切都编译并运行,同时interface不是class(或者是吗?)。为什么会这样?我第一次看到这个是在我的WCF代理类上:publicpartialclassTestServiceClient:System.ServiceModel.ClientBase,TestNamespace.ITestService

c# - 代码契约(Contract) : Why are some invariants not considered outside the class?

考虑这个不可变类型:publicclassSettings{publicstringPath{get;privateset;}[ContractInvariantMethod]privatevoidObjectInvariants(){Contract.Invariant(Path!=null);}publicSettings(stringpath){Contract.Requires(path!=null);Path=path;}}这里需要注意两点:有一个保证Path属性永远不会为null的契约不变量构造函数检查path参数值以遵守先前的契约不变量此时,Setting实例永远不能有n