小编big*_*7bb的帖子

VS2010代码片段快捷方式未显示

我在VS2010中创建了一个代码片段.当我开始输入时,它没有显示为快捷方式.我把它称为恶作剧.

它在我使用Ctrl-K,Ctrk-X时可用,但是当我刚开始键入prop时...它没有显示为选项.

我错过了某种设置吗?

我有屏幕截图,但我不认为SO允许你上传任何.

编辑:屏幕截图

我可以通过Ctrl-K,Ctrl-X看到我的片段(当我按住Ctrl-PrtScn截取屏幕时它变灰了)

在此输入图像描述

但它不会与其他代码段快捷方式一起出现.

在此输入图像描述

代码片段代码(取自本教程)并位于"Documents\Visual Studio 2010\Code Snippets\Visual C#\ My Code Snippets"文件夹中.

<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
    <Header>
        <Title>propnch</Title>
        <Shortcut>propnch</Shortcut>
        <Description>Code snippet for property and backing field and ensure 
  that it invokes INotifyPropertyChanigng and INotifyPropertyChanged</Description>
        <Author>Abhishek</Author>
        <SnippetTypes>
            <SnippetType>Expansion</SnippetType>
        </SnippetTypes>
    </Header>
    <Snippet>
        <Declarations>
            <Literal>
                <ID>type</ID>
                <ToolTip>Property type</ToolTip>
                <Default>int</Default>
            </Literal>
            <Literal>
                <ID>property</ID>
                <ToolTip>Property name</ToolTip>
                <Default>MyProperty</Default>
            </Literal>
            <Literal>
                <ID>field</ID>
                <ToolTip>The variable backing this property</ToolTip>
                <Default>myVar</Default>
            </Literal>
        </Declarations>
        <Code Language="csharp"><![CDATA[

private $type$ $field$;

public $type$ $property$ …
Run Code Online (Sandbox Code Playgroud)

visual-studio-2010 code-snippets

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

删除Orchard Footer中的登录链接

我想删除我Orchard网站最底层的登录链接.我想转到/ Users/Account/LogOn链接登录,但没有显示链接.我不认为在面向公众的网站上这是必要的,不应该在那里.

我似乎只能删除或编辑常规页脚.有谁知道我怎么做到这一点?

编辑 - 我也希望能够从内容中删除发布日期.我不需要发布的日期显示在一个简单的页面上.这个功能是否存在,修复不直观....或者我只是有点慢.

orchardcms

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

Terraform,从null_resource,local-exec和AWS CLI获取输出

我正在使用Terraform在AWS中自动提供Cognito Identity Pools.AWS提供商尚不支持Cognito,所以我一直在使用null_resource和local-exec来调用AWS CLI.

我有以下资源:

resource "null_resource" "create-identitypool" {
    provisioner "local-exec" {
        command = "aws cognito-identity create-identity-pool --identity-pool-name terraform_identitypool --no-allow-unauthenticated-identities --developer-provider-name login.terraform.myapp"
    }
}
Run Code Online (Sandbox Code Playgroud)

它给出了以下输出:

null_resource.create-identitypool (local-exec): {
null_resource.create-identitypool (local-exec):     "IdentityPoolId": "eu-west-1:22549ad3-1611-......",
null_resource.create-identitypool (local-exec):     "AllowUnauthenticatedIdentities": false,
null_resource.create-identitypool (local-exec):     "DeveloperProviderName": "login.terraform.myapp",
null_resource.create-identitypool (local-exec):     "IdentityPoolName": "terraform_identitypool"
null_resource.create-identitypool (local-exec): }
null_resource.create-identitypool: Creation complete
Run Code Online (Sandbox Code Playgroud)

下一步是将一些我已经创建的角色添加到身份池:

resource "null_resource" "attach-policies-identitypool" {
    provisioner "local-exec" {
        command = "aws cognito-identity set-identity-pool-roles --identity-pool-id ${null_resource.create-identitypool.IdentityPoolId} --roles authenticated=authroleXXX,unauthenticated=unauthroleXXX"
    }
}
Run Code Online (Sandbox Code Playgroud)

问题是我无法提取IdentityPoolId,$ {null_resource.create-identitypool.IdentityPoolId},以便在第二个资源中使用.我理解null_resource没有输出属性,所以如何从命令行输出中获取此JSON对象.我还想使用tirggers并运行aws cognito-identity list-identity-pools和可能的delete-identity-pool来使这一切都可重复,我也需要输出.

有任何想法吗?如果我在其他地方错过了这些信息,我会道歉.我也在Terraform邮件列表上问了这个问题,但我想我会尝试更广泛的受众.

蒂姆,谢谢

amazon-web-services aws-cli amazon-cognito terraform

8
推荐指数
3
解决办法
7748
查看次数

MySQL:循环数据库并在其上运行存储过程

我对 MySQL 很陌生,我有一个存储过程,我想将其添加到几个旧数据库中。我正在使用 SQLyog,我想循环访问连接上的每个数据库,如果它匹配“application_%”(称为数据库application_clientName,有几十个)来运行存储过程。

我可以保存并通过 SQLyog 运行的脚本将是理想的选择。

我希望循环显示数据库中的所有数据库,并运行一条语句(如果它们的名称类似于“application_%”)。该语句将在该数据库中创建一个通用存储过程。

mysql database loops

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

NHibernate设置access ="field.camelcase-underscore"在版本3中失败

我有一个用NHib 1.2创建的解决方案,我们正在升级到NHib 3.0.

我们的hbm文件具有以下属性:

<property name="ContentId" column="ContentId" access="field.camelcase-underscore" />
Run Code Online (Sandbox Code Playgroud)

该类没有ContentId属性.这在NHib 1.2中运行良好,但现在我们得到以下异常:

Could not compile the mapping document: XXXX.Core.Domain.Video.hbm.xml ---> NHibernate.MappingException: Problem trying to set property type by reflection ---> NHibernate.MappingException: class Core.Domain.Video, Core, Version=1.0.0.29283, Culture=neutral, PublicKeyToken=null not found while looking for property: ContentId ---> NHibernate.PropertyNotFoundException: Could not find the property 'ContentId', associated to the field '_contentId', in class 'Core.Domain.Video'.
Run Code Online (Sandbox Code Playgroud)

为什么这会停止工作?NHib 3还支持吗?

我们可能需要添加许多这样的属性.

nhibernate

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

应用程序在网络共享时的MEF组合

我有一个MEF应用程序,在本地运行时效果很好,但在网络共享上远程调用时不起作用.

我正在使用Assembly.LoadFrom来避免UNC问题,但看到所有的dll都位于exe旁边,我并不认为这会是问题所在,但我尝试了任何方式.

在查看msdn之后,我还修复了ConfigurationManager.GetSection问题,这似乎是.NET 4权限的常见问题.

<loadFromRemoteSources enabled="true"/>在配置文件中允许.所以我不确定问题出在哪里.

编辑:例外中的ProductDispatcher在catalog.Parts中是明确的.

设置容器和目录的代码:

var catalog = new AggregateCatalog();

var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

foreach (string file in Directory.GetFiles(dir, "XXX*.dll"))
{
    var assembly = Assembly.LoadFrom(file);
    catalog.Catalogs.Add(new AssemblyCatalog(assembly));
}

var container = new CompositionContainer(catalog);
var batch = new CompositionBatch();
batch.AddPart(this);
container.Compose(batch);
Run Code Online (Sandbox Code Playgroud)

导入是(我试过公开):

[ImportMany(typeof(IEntityTypeDispatcher))]
private IEnumerable<IEntityTypeDispatcher> Dispatchers { get; set; }
Run Code Online (Sandbox Code Playgroud)

导出的一个例子是:

[Export(typeof(IEntityTypeDispatcher))]
internal class ContactDispatcher : EntityTypeDispatcher<Contact>
Run Code Online (Sandbox Code Playgroud)

我得到的异常错误是:

The composition produced a single composition error. The root cause is provided below. Review the …
Run Code Online (Sandbox Code Playgroud)

.net mef composition

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

Visual Studio代码-Ctrl +。在名称空间中添加usings

我正在使用将使用语句放入命名空间的约定:

namespace ShoppingCart.Modules
{
  using Nancy;
  using Nancy.ModelBinding;

  public CartModule : NancyModule
  ...
Run Code Online (Sandbox Code Playgroud)

但是,按Ctrl +。默认情况下将它们添加到外部(除非名称空间中已经有using语句)。

如何配置VS Code,以使其始终默认为在名称空间内添加using语句,而不必至少手动移动第一个?

visual-studio-code vscode-settings

5
推荐指数
0
解决办法
266
查看次数

在VS2010中禁止编译器警告

我正在尝试清除我的解决方案在VS2010中编译时发出的警告.目前有大约600个,但大多数似乎是由于MSpec文件.

如何禁止任何结束*spec.cs的文件的警告?它们用于MSpec测试并修复其中许多测试代码的流程.我确信在产品发货时我不需要考虑这些.

compiler-construction visual-studio-2010 visual-studio

4
推荐指数
2
解决办法
9403
查看次数

使用 WIX 并行安装同一 IIS 站点的版本

是否可以使用 WIX 并行安装同一 IIS 网站的多个版本。包括单独升级它们的能力吗?我到处搜索,但在互联网上找不到任何相关内容。

另外,为什么在每次构建时使用热量自动收集文件是不可以的?如果您在开发过程中大量添加视图、模型、控制器,那么当文件结构已经在 VS 和源代码控制中处理时,必须手动更新 WIX 中的文件结构是一件很痛苦的事情。

我希望能够在 TFS 构建期间发布站点,然后收集安装程序的输出。

有没有比 WIX 更好的方法来做到这一点?但像 Octopus 或 Web Deploy 这样的部署工具不是一个选择,因为它需要是一个安装程序。付费选项也已退出。

installation wix wix3.5

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

Linq将整数的子列表与整数列表相交

我有一个用户列表,每个用户都包含一个关联的店面ID列表.我有一个单独的整数列表,我想找到用户的任何店面ID与单独列表中的任何整数匹配的位置.

我期待这样的事情:

clientUsers = clientUsers.Where(x => x.Storefronts.Intersect(allowedStorefrontIds));
Run Code Online (Sandbox Code Playgroud)

我被告知类型参数不能从Where扩展方法的用法推断出来.

在这种情况下,你知道我应该如何构建我的linq吗?

linq linq-to-objects

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

在TeamCity中构建时找不到CompareAttribute(在Windows Server 2012 RC上)

我正在尝试在安装在Windows Server 2012 RC服务器上的TeamCity上构建一个MVC项目.

我收到以下错误.它看起来像MVC版本的某种冲突,如果我一直在谷歌搜索时发现的.我正在通过版本明确地引用system.web.mvc等,所以我不知道问题是什么.有任何想法吗?

Models\AccountModels.cs(26, 10): error CS0246: The type or namespace name 'Compare' could not be found (are you missing a using directive or an assembly reference?) 
Models\AccountModels.cs(26, 10): error CS0104: 'CompareAttribute' is an ambiguous reference between 'System.ComponentModel.DataAnnotations.CompareAttribute' and 'System.Web.Mvc.CompareAttribute' 
Models\AccountModels.cs(64, 10): error CS0246: The type or namespace name 'Compare' could not be found (are you missing a using directive or an assembly reference?) 
Models\AccountModels.cs(64, 10): error CS0104: 'CompareAttribute' is an ambiguous reference between 'System.ComponentModel.DataAnnotations.CompareAttribute' and 'System.Web.Mvc.CompareAttribute' 
Run Code Online (Sandbox Code Playgroud)

teamcity windows-server asp.net-mvc-3

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