Welcome Guest Search | Active Topics | Members | Log In | Register

ashx file in vs2008? Options · View
hh
Posted: Sunday, May 04, 2008 8:20:44 AM
Rank: Newbie
Groups: Member

Joined: 5/4/2008
Posts: 1
Points: 3
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
Alvaro
Posted: Monday, May 05, 2008 8:37:58 PM
Rank: Administration
Groups: Administration

Joined: 3/16/2008
Posts: 22
Points: 72
Location: Spain
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>






Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008