草庐IT

using-size-classes-xcode

全部标签

c# - ASP.NET MVC : Views using a model type that is loaded by MEF can't be found by the view engine

我正在尝试创建一个框架,以允许将Controller和View动态导入到MVC应用程序中。到目前为止,它是这样工作的:我正在使用.NET4、ASP.NETMVC3RC和RazorViewEngine每个项目都使用MEF导出和导入Controller-我将给定项目中的一组Controller和View称为“模块”BuildManager使用应用前启动方法和BuildManager.AddReferencedAssembly动态引用使用MEF发现的程序集。使用构建事件将二进制文件(来自导出项目)和View复制到目标项目的文件夹结构中使用自定义Controller工厂选择Controller

c# - The non-generic method cannot be used with type arguments in this context 是什么意思?

我有以下类和方法:publicclassUserManager:IDisposablewhereTUser:class,global::Microsoft.AspNet.Identity.IUserwhereTKey:global::System.IEquatable{publicvirtualTaskFindByIdAsync(TKeyuserId);和:privateApplicationUserManager_userManager;publicApplicationUserManagerUserManager{get{return_userManager??Request.Ge

c# - LINQ 如何在 using 语句中延迟执行

假设我有以下内容:privateIEnumerableMyFunc(parametera){using(MyDataContextdc=newMyDataContext){returndc.tablename.Select(row=>row.parameter==a);}}privatevoidUsingFunc(){varresult=MyFunc(newa());foreach(varrowinresult){//Dosomething}}根据文档,linq执行将推迟到我实际枚举结果时,该结果出现在foreach的行中。但是,using语句应强制在调用MyFunct()结束时可靠地

c# - 通过反射仅获取当前类(class)成员

假设这段代码:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Reflection;namespaceTestFunctionality{classProgram{staticvoidMain(string[]args){//System.Reflection.Assembly.GetExecutingAssembly().LocationAssemblyassembly=Assembly.LoadF

c# - 混淆使用 "using"语句 C#

根据MSDNLibraryusingStatement(C#Reference)Definesascope,outsideofwhichanobjectorobjectswillbedisposed.但是我得到了一些用户在这里发布的这段代码,我对此感到困惑:(请参阅我对代码的评论)using(OleDBConnectionconnection=newOleDBConnection(connectiongString)){if(connection.State!=ConnectionState.Open)connection.Open();stringsql="INSERTINTOStu

C#/N 休眠 : Association references unmapped class

几个小时以来,我一直在努力解决这个NHibernate问题。我在网络和NHibernate文档上进行了广泛的研究,但我无法理解这个问题。我对NHibernate比较陌生,但很喜欢它。不过,在那种情况下,它让我发疯。我正在为网站编写一个小型“投票”模块。我有几个类(Poll、PollVote和PollAnswer)。主要的Poll是导致问题的原因。这就是类的样子:publicclassPoll{publicvirtualintId{get;set;}publicvirtualSiteSite{get;set;}publicvirtualstringQuestion{get;set;}pu

c# - cs0030 :Unable to generate a temporary class

我有一个Web服务,当我尝试生成它的对象时出现以下错误。"Unabletogenerateatemporaryclass(result=1).errorCS0030:Cannotconverttype'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment[]'to'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment'errorCS0030:Cannotconverttype'ShortSell.ShortSellRSOriginDestina

c# - 公共(public)静态字符串 MyFunc() 上的 "Expected class, delegate, enum, interface or struct"错误。什么 's an alternative to "字符串”?

当我尝试使用以下静态函数时出现错误。错误:Expectedclass,delegate,enum,interface,orstruct函数(和类):namespaceMyNamespace{publicclassMyClass{//SomeotherstaticmethodsthatuseClasses,delegates,enums,interfaces,orstructspublicstaticstringMyFunc(stringmyVar){stringmyText=myVar;//DosomestuffwithmyTextandmyVarreturnmyText;}}}这导致

c# - 简单注入(inject)器 : Register ILogger<T> by using ILoggerFactory. CreateLogger<T>()

我正在处理一个使用简单注入(inject)器作为依赖注入(inject)器的项目。另一方面,该项目使用Microsoft.Extensions.Logging来记录某些类中发生的事件。我的技术问题很容易解释。我想在我的DI中独立于正在调用的类T注册ILogger,但是我确实需要从我的ILoggerFactory.CreateLogger()中完成它方法,因为这会使用Microsoft.Extensions.Configuration获取记录器配置.我需要使用这样的东西来实例化我的记录器:privateMicrosoft.Extensions.Logging.ILoggerCreateL

c# - 如何调整 "is a type but is used like a variable"?

我正在尝试在网络服务中生成一些代码。但它返回了2个错误:1)List是一种类型,但像变量一样使用2)方法“Customer”没有重载接受“3个参数”[WebService(Namespace="http://tempuri.org/")][WebServiceBinding(ConformsTo=WsiProfiles.BasicProfile1_1)][ToolboxItem(false)]publicclasswstest:System.Web.Services.WebService{[WebMethod]publicListGetList(){Listli=List();li.A