草庐IT

products_model

全部标签

c# - 从范围引用了类型为 'x' 的变量 'Product',但未定义

我在类库项目中有一个名为Product的类。我正在使用SubSonicSimpleRepository来保存对象。我在Product类中有如下方法:publicstaticIListLoad(Expression>expression){varrep=RepoHelper.GetRepo("ConStr");varproducts=rep.Find(expression);returnproducts.ToList();}我这样调用这个函数:privatevoidBindData(){varlist=Product.Load(x=>x.Active);//Activeisoftypeb

c# - 'Property:NETFRAMEWORK45' 部分中对符号 'Product:*' 的未解决引用

在TFS2010中构建应用程序时出现错误。未解决对“产品:*”部分中符号“属性:NETFRAMEWORK45”的引用。这是用于Wix3.9Wix包引用了NetFxExtension。我可以在我的本地机器上很好地构建wix,但是当我通过TFS构建它时,我得到了错误。谁能帮我解决这个问题?我有以下导致错误的代码。 最佳答案 您必须在您的项目中包含WixNetFxExtension,最多3个位置在wxs文件的Wix元素中,添加命名空间xmlns:netfx="http://schemas.microsoft.com/wix/NetFxEx

c# - 将文件夹名称与 Productivity Power Tools 颜色编码相匹配的正则表达式

我想配置RexEx以匹配任何打开文件的文件路径的任何文件夹(父文件夹或子文件夹)。因此,如果文件路径中的任何文件夹包含打开文件的名称,则选项卡的颜色编码将根据RegEx匹配设置。例如:websiteRoot/Content/MyName1/site.css=文件打开时的绿色标签websiteRoot/Content/MyName2/site.css=文件打开时的橙色标签websiste/Shared/MasterPages/MyName1/main.master=文件打开时的绿色标签websiste/Shared/MasterPages/MyName2/main.master=文件打开

c# - MVC 错误 : The model item passed into the dictionary is null

我只是想建立一个View,但我收到以下错误:System.InvalidOperationException:Themodelitempassedintothedictionaryisnull,butthisdictionaryrequiresanon-nullmodelitemoftype'System.DateTime现在,我知道为什么会出现这种情况,数据库中的特定字段是空值,但它应该是空值,因为这是稍后编辑的内容。这是我的代码:ActionpublicActionResultView(Int64?Id){ModelContainerctn=newModelContainer();

c# - 当部分 View 位于共享文件夹中时,ASP.NET MVC '@model dynamic' 无法识别模型属性

不重复:MVCRazordynamicmodel,'object'doesnotcontaindefinitionfor'PropertyName'根据那里的答案,AccordingtoDavidEbbo,youcan'tpassananonymoustypeintoadynamically-typedviewbecausetheanonymoustypesarecompiledasinternal.SincetheCSHTMLviewiscompiledintoaseparateassembly,itcan'taccesstheanonymoustype'sproperties.为什

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# - Model 和 ViewModel 的验证最佳实践

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