我的公司名称以小写"i"开头.例如:iWare(这不是真正的公司名称,但它表明了目的).
因此,我发现由于命名空间命名规则/约定,我不断地与StyleCop和Resharper作斗争.
有没有人有任何想法我应该如何命名我的命名空间(有时候是类).
例如.
namespace iWare.Product.X
{
...
}
Run Code Online (Sandbox Code Playgroud)
可以想象,上面显示的大多数工具都不喜欢这样.对于替代方案应该有什么建议吗?我尝试使用以下方法抑制错误:
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "Reviewed. Suppression is OK here.")]
namespace iWare.Product.X
{
...
}
Run Code Online (Sandbox Code Playgroud)
但是,这会导致以下错误:名称空间声明不能包含修饰符或属性
有任何想法吗?
有没有人在c#中有一个算法来准确计算给定DateTime格式的年龄,其格式为Years.Months?
例如.
答案:23.4
DOB:1991年3月31日
答案:20.10
DOB:1991年2月25日
谢谢
有没有办法清除所有用户的会话缓存密钥?
例如,我将当前所选商店项目的用户存储在以下会话密钥"currentItem"下.在网站的管理区域,我决定删除该特定商店项目.我现在想要使所有会话中的所有"currentItem"缓存条目无效.
有没有办法做到这一点?
我意识到我给出的例子有点做作,但它得到了重点.我怀疑一个解决方案是使用普通的Cache api来存储所有用户的当前项目.这样我就可以在需要时使它们无效.
谢谢
我正在使用SqlPackage.exe我的部署.我已经阅读了这里的文档以供使用SqlPackage.exe.
该文档仅说明一个变量的synax:
为特定于操作的变量指定名称值对; {VARIABLENAME} = {}值.DACPAC文件包含有效SQLCMD变量的列表.如果没有为每个变量提供值,将导致错误.
我的问题是文档没有说明如何将多个参数传递给Variables参数.例如,我想这样做:
sqlpackage.exe ...args go here... /Variables:VarToOverride=Value1,Var2ToOverride=Value2
Run Code Online (Sandbox Code Playgroud)
有谁知道这个的语法?
我正在使用新的 ASP.Net 和 Web 工具 2012.2发布网站配置文件(不是 Web 应用程序)。
我使用在网站根目录中创建文件的工具创建了一个发布配置文件website.publishproj。
该website.publishproj文件包含以下内容:
<AssemblyAttributes Include="AssemblyFileVersion">
<Value>$(AssemblyFileVersion)</Value>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyVersion">
<Value>$(AssemblyVersion)</Value>
</AssemblyAttributes>
Run Code Online (Sandbox Code Playgroud)
这表明您可以将属性传递给 MSBuild 以设置输出 dll 的版本。
但是,网站的单个输出程序集(编译后合并为单个程序集)始终具有版本号1.0.0.0.
我试过传入,/p:AssemblyFileVersion=2.1.0.0;AssemblyVersion=2.1.0.0但这没有效果。
我什至尝试过直接编辑 website.publishproj 文件,但这也没有效果。
有谁知道当您希望将其合并到单个程序集时如何在网站项目上设置输出程序集的版本号?
我配置TFS2012团队构建.在配置期间,构建服务显示状态正在运行,稍后(可能是10秒)构建控制器和构建代理服务停止.但在管理构建控制器窗口中,我的TFS2012控制器和代理显示可用.
因此我触发了为此控制器配置的构建定义,即使在显示"正在运行0秒"并在队列中等待5分钟后也是如此.
在事件查看器日志中,我可以看到记录以下错误:
WebHost无法处理请求.发件人信息:System.ServiceModel.ServiceHostingEnvironment + HostingManager/39086322异常:System.ServiceModel.ServiceActivationException:"/tfs/queue//Services/v4.0/MessageQueueService2.svc"服务无法启动,由于编译过程中的异常.异常消息是:此集合已包含带有方案http的地址.此集合中每个方案最多只能有一个地址.如果您的服务在IIS所驻留你可以通过设置"system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled"为真或指定"system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters"解决问题.参数名称:item.---> System.ArgumentException:此集合已包含方案http的地址.此集合中每个方案最多只能有一个地址.如果您的服务在IIS所驻留你可以通过设置"system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled"为真或指定"system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters"解决问题.参数名称:在System.ServiceModel.UriSchemeKeyedCollection.InsertItem(的Int32索引,乌里项)在System.Collections.Generic.SynchronizedCollection`1.Add(T项)在System.ServiceModel.UriSchemeKeyedCollection..ctor(URI []地址)项在System.ServiceModel.ServiceHost..ctor(类型的serviceType,乌里[] baseAddresses)在System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(类型的serviceType,乌里[] baseAddresses)在System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(字符串constructorString ,Uri [] baseAddresses)在System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo,EventTraceActivity eventTraceActivity)的System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath,EventTraceActivity eventTraceActivity),位于System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable (String normalizedVirtualPath,EventTraceActivity甚至 tTraceActivity)---内部异常堆栈跟踪结束---在System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath,EventTraceActivity eventTraceActivity)System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath,EventTraceActivity eventTraceActivity)进程名称:w3wp进程ID:6104提前感谢.
我正在尝试将TFS 2012事件通知连接到ServiceStack,但我只是不断收到错误:
{
"responseStatus": {
"errorCode": "RequestBindingException",
"message": "Unable to bind request",
"stackTrace": "at ServiceStack.WebHost.Endpoints.RestHandler.GetRequest(IHttpRequest httpReq, IRestPath restPath)\r\n
at ServiceStack.WebHost.Endpoints.RestHandler.ProcessRequest (IHttpRequest httpReq, IHttpResponse httpRes, String operationName)"
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的DTO(它包含了我尝试使其工作的一些部分).
[Route("/releasemanagement/tfsevents/buildcomplete", "POST")]
[DataContract(Namespace = "http://www.w3.org/2001/XMLSchema-instance")]
public class TfsEventBuildComplete : IReturn<BuildCompleteResponse>
{
[DataMember]
public string BuildUri { get; set; }
[DataMember]
public string TeamFoundationServerUrl { get; set; }
[DataMember]
public string TeamProject { get; set; }
[DataMember]
public string Title { get; set; }
[DataMember]
public string Id { get; set; } …Run Code Online (Sandbox Code Playgroud) asp.net ×2
algorithm ×1
c# ×1
caching ×1
clear ×1
msbuild ×1
namespaces ×1
naming ×1
resharper ×1
servicestack ×1
session ×1
sql-server ×1
stylecop ×1
team-build ×1
tfs ×1
tfs2012 ×1