hh wrote:It looks like can not work well in an ashx file in vs2008
i input
string test p
Ctrl + Enter
but AutoCode doesn’t work
The 'Property' command is defined as:
<ActiveDocument extensions=".cs"/>
which means to work only with extensions ".cs". You can change it to
<ActiveDocument extensions=".cs; .ashx"/>
to support both extensions, or to
<ActiveDocument extensions="*"/>
to work with any extension.
Also, the ".ashx' files don't support CodeModel, so you need to remove
codeElement="Class" codePoint="EndOfFields"
sor the <Codes> section look like this:
Code: <Code id="Field">
<![CDATA[private <%=args[0]%> <%=ToUnderscore(args[1])%>;
]]>
</Code>
<Code id="Prop">
<![CDATA[public <%=args[0]%> <%=ToPascalCase(args[1])%>
{
get { return <%=ToUnderscore(args[1])%>; }
set { <%=ToUnderscore(args[1])%> = value; }
}]]>
</Code>
This is the full command that will work with ".ashx" files:
Code:<?xml version="1.0"?>
<Commands xmlns="http://schemas.devprojects.net/AutoCode/v3.0">
<Command name="Property" priority="100">
<CommandBehavior>
<CommandLine shortcut="p" />
<ActiveDocument extensions=".cs;.ashx"/>
</CommandBehavior>
<CommandInfo>
<LanguageCategory>CSharp</LanguageCategory>
<Category>Members/Properties</Category>
<Usage>
<![CDATA[<type> <name> p]]>
</Usage>
<Description>Creates a property Get/Set with a background field with the given type and name.</Description>
<Author>DevProjects</Author>
<HelpUrl>http://www.devprojects.net</HelpUrl>
</CommandInfo>
<CommandCode language="csharp">
<Codes>
<Code id="Field">
<![CDATA[private <%=args[0]%> <%=ToUnderscore(args[1])%>;
]]>
</Code>
<Code id="Prop">
<![CDATA[public <%=args[0]%> <%=ToPascalCase(args[1])%>
{
get { return <%=ToUnderscore(args[1])%>; }
set { <%=ToUnderscore(args[1])%> = value; }
}]]>
</Code>
</Codes>
<!-- Positions cursor at the end of the property -->
<Selection codeElement="Prop" codePoint="EndOfElement" />
</CommandCode>
</Command>
</Commands>