草庐IT

model_instance

全部标签

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# - SOAP 错误 : "Server was unable to process request" "Object reference not set to an instance of an object"

当我向本地IIS中的服务发送SOAP请求时,一切正常。当我向在另一台主机上的IIS上运行的同一服务发送SOAP请求时,一切正常。但是当另一个程序员向我的服务发送SOAP请求时,他通常会得到正确的响应,除了返回服务中的一个方法:soap:ServerServerwasunabletoprocessrequest.--->Objectreferencenotsettoaninstanceofanobject.我需要了解他收到此错误的原因。他的SOAP请求与SOAP请求完全相同,但我的有效,而他的无效。 最佳答案 如果您不确切知道错

c# - 扩展 ASP.NET 身份角色 : IdentityRole is not part of the model for the current context

我正在尝试在我的MVC5应用程序中使用新的ASP.NETIdentity,特别是我正在尝试将ASP.NETIdentity集成到现有数据库中。我已经阅读了有关DBFirst和ASP.NETIdentity的SO问题/答案,并且遵循了所有建议我仍然无法向我的数据库添加角色,尽管我在添加用户时没有问题。这是我的代码:varcontext=newPayrollDBEntities();varroleManager=newRoleManager(newRoleStore(context));boolroleExists=roleManager.RoleExists(roleDto.Name);

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# - OData 和 WebAPI : Navigation property not present on model

我正在尝试使用EntityFramework、WebAPI、OData和Angular客户端组合一个简单的玩具项目。一切正常,除了我在其中一个模型上放置的导航属性似乎不起作用。当我使用$expand调用我的API时,返回的实体没有它们的导航属性。我的类是Dog和Owner,看起来像这样:publicclassDog{//Properties[Key]publicGuidId{get;set;}publicStringName{get;set;}[Required]publicDogBreedBreed{get;set;}publicintAge{get;set;}publicintWe

c# - “模型”与声明“System.Web.Mvc.WebViewPage<TModel>.Model”冲突

我想显示以下客户对象。publicClassCustomer{publiclongId{get;set;}publicstringName{get;set;}publicAddressAddressInfo{get;set;}}publicclassAddress{publicstringDetails{get;set;}publicCityCityInfo{get;set;}publicRegionRegionInfo{get;set;}}并且有一个Controller返回给客户查看publicActionResultGetCustomer(longId){returnView("C

c# - 尝试打开 telerik 报告时出现 "Value cannot be null. Parameter name: instance"错误

在我的解决方案中,我有telerik报告,当尝试在VisualStudio2010设计器中打开它们时,我收到此错误:Valuecannotbenull.Parametername:instanceCallStackatSystem.ComponentModel.TypeDescriptor.AddAttributes(Objectinstance,Attribute[]attributes)atMicrosoft.VisualStudio.Design.VSDesignSurface.CreateDesigner(IComponentcomponent,BooleanrootDesig

c# - Model 和 ViewModel 的验证最佳实践

我有单独的模型和View模型类。其中viewmodel类仅进行UI级别验证(引用:Validation:ModelorViewModel)。我可以在Controller中验证模型(vewmodel)是否有效。问:如何验证模型(带有数据注释的主要实体)。我没有使用模型对象开发View模型。只需复制属性并添加该特定View中可能需要的所有属性。//ModelClasspublicclassUser{[Required]publicstringEmail{get;set;}[Required]publicDateTimeCreated{get;set;}}//ViewModelClasspu

c# - 处理 ViewModel/Model 中的致命异常

我有一个使用M-V-VM方法编写的应用程序。数据访问在模型中完成。如果此处发生fatalerror(例如,与数据源的连接丢失),则抛出Exception。此异常冒泡到ViewModel。但是,因为数据访问的原始触发器是数据绑定(bind),WPF吞下了这个异常(它只在应用程序在调试器下运行时记录在输出窗口中)。我宁愿这个异常保持未处理状态,这样我的应用程序范围内的未处理异常处理程序就可以拾取它、记录它并优雅地退出。我怎样才能做到这一点? 最佳答案 您可以在调度程序上对异常抛出操作进行排队。//Thispropertyisconnec

c# - MVC3 全局化 : need global filter before model binding

目前,我有一个名为GlobalizationFilter的全局过滤器,它检查路由值、cookie和浏览器语言header以确定请求的正确文化设置:publicoverridevoidOnActionExecuting(ActionExecutingContextfilterContext){//determinecultureInfoThread.CurrentThread.CurrentCulture=cultureInfo;Thread.CurrentThread.CurrentUICulture=cultureInfo;}一切正常,但模型绑定(bind)过程似乎发生在全局过滤器之