小编lew*_*wis的帖子

Visual Studio 2015中的ReactJS(JSX)语法高亮显示

我正在阅读"在VS 2015中内置支持jsx语法",但找不到它.它隐藏在IDE的设置中,还是需要安装一些扩展?

visual-studio reactjs react-jsx

9
推荐指数
1
解决办法
2万
查看次数

为什么我不能将属性转换为嵌套元素?

我正在从'App.config'中读取设置.我只是想出了如何使用ConfigurationSection,ConfigurationElementCollectionConfigurationelElement.

App.config中:

<?xml version="1.0" encoding="utf-8" ?>
<configuration> 
    <configSections>
        <sectionGroup name="notificationSettingsGroup">
                <section name="mailTemplates" type="Project.Lib.Configuration.MailTemplateSection, Project.Lib"
                    allowDefinition="Everywhere" allowExeDefinition="MachineToApplication" requirePermission="false"/>
        </sectionGroup>         
    </configSections>
    <notificationSettingsGroup>
        <mailTemplates>
            <items>
                <mailTemplate name="actionChain" subject="Subject bla-bla">
                    <body>Body bla-bla</body>
                </mailTemplate>                 
            </items>
        </mailTemplates>
    </notificationSettingsGroup>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>  
</configuration>
Run Code Online (Sandbox Code Playgroud)

我的C#代码:

public class MailTemplateSection : ConfigurationSection
{
    [ConfigurationProperty("items", IsDefaultCollection = false)]
    public MailTemplateCollection MailTemplates
    {
        get { return (MailTemplateCollection)this["items"]; }
        set { this["items"] = value; }
    }
}
Run Code Online (Sandbox Code Playgroud)
[ConfigurationCollection(typeof(MailTemplateElement), AddItemName = "mailTemplate",
    CollectionType = ConfigurationElementCollectionType.AddRemoveClearMap)]
public …
Run Code Online (Sandbox Code Playgroud)

.net c# xml app-config

6
推荐指数
1
解决办法
2783
查看次数

ASP.NET MVC 4 - 一个视图中的多个模型

我刚开始使用ASP.NET MVC 4开始新项目,我有疑问.

我如何在一个视图中使用多个模型(或ViewModel-s)?我通过Internet搜索,标准解决方案是"创建具有2个或更多属性的复杂视图模型",例如:

public class ComplexViewModel   
{
    public LoginModel LoginModel { get; set; }
    public CartModel CartModel { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

但是,例如,在每个页面中,我将至少有 2个模型 - LoginModel和另一个模型(取决于页面).那么,我需要在每个ViewModel中定义LoginModel吗?

PS:我正在使用ASP.NET MVC 4,Entity Framework 5.

.net c# entity-framework mvvm asp.net-mvc-4

1
推荐指数
1
解决办法
5185
查看次数