Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MM Code Snippets
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01419052
Message ID:
01420752
Vues:
51
I added another one. mbprop creates a property with lazy instantiation of a business object. It saves several keystrokes on each property.

Below is the new version of the snippet file.
<?xml version="1.0" encoding="utf-8"?>

<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">

    <Header>
      <Title>
        GetEntity
      </Title>
      <Shortcut>GetEntity</Shortcut>
    </Header>
    <Snippet>
      <Code Language="CSharp">
        <![CDATA[		
		public $ABusinessEntity$ $MethodName$($ParameterType$ $ParameterName$)
		{
			return this.GetEntity("$StoredProcedureName$", this.CreateParameter("@$StoredProcedureParameterName$", $StoredProcedureParameterValue$));
		} ]]>
      </Code>

      <Declarations>
        <Object>
          <ID>ABusinessEntity</ID>
          <Type>ABusinessEntity</Type>
          <ToolTip>Replace with the entity type being returned</ToolTip>
          <Default>ABusinessEntity</Default>
        </Object>
        <Object>
          <ID>MethodName</ID>
          <Type>string</Type>
          <ToolTip>Enter the method name</ToolTip>
          <Default>Get</Default>
        </Object>
        <Object>
          <ID>ParameterType</ID>
          <Type>int</Type>
          <ToolTip>Enter the parameter type</ToolTip>
          <Default>int</Default>
        </Object>
        <Object>
          <ID>ParameterName</ID>
          <Type>string</Type>
          <ToolTip>Enter the method parameter name</ToolTip>
          <Default>parameter</Default>
        </Object>
        <Object>
          <ID>StoredProcedureName</ID>
          <Type>string</Type>
          <ToolTip>Enter the Stored Procedure name</ToolTip>
          <Default>spName</Default>
        </Object>
        <Object>
          <ID>StoredProcedureParameterName</ID>
          <Type>string</Type>
          <ToolTip>Enter the Stored Procedure Parameter name</ToolTip>
          <Default>spParameterName</Default>
        </Object>
        <Object>
          <ID>StoredProcedureParameterValue</ID>
          <Type>string</Type>
          <ToolTip>Enter the Stored Procedure Value</ToolTip>
          <Default>spParameterValue</Default>
        </Object>
      </Declarations>
    </Snippet>
  </CodeSnippet>

  <CodeSnippet Format="1.0.0">

    <Header>
      <Title>
        GetEntityList
      </Title>
      <Shortcut>GetEntityList</Shortcut>
    </Header>
    <Snippet>
      <Code Language="CSharp">
        <![CDATA[		
		public $ABusinessEntityList$ $MethodName$($ParameterType$ $ParameterName$)
		{
			return this.GetEntityList("$StoredProcedureName$", this.CreateParameter("@$StoredProcedureParameterName$", $StoredProcedureParameterValue$));
		} ]]>
      </Code>

      <Declarations>
        <Object>
          <ID>ABusinessEntityList</ID>
          <Type>
            <![CDATA[mmBindingList<ABusinessEntity>]]></Type>
          <ToolTip>Replace with the entity type being returned</ToolTip>
          <Default><![CDATA[mmBindingList<ABusinessEntity>]]></Default>
        </Object>
        <Object>
          <ID>MethodName</ID>
          <Type>string</Type>
          <ToolTip>Enter the method name</ToolTip>
          <Default>Get</Default>
        </Object>
        <Object>
          <ID>ParameterType</ID>
          <Type>int</Type>
          <ToolTip>Enter the parameter type</ToolTip>
          <Default>int</Default>
        </Object>
        <Object>
          <ID>ParameterName</ID>
          <Type>string</Type>
          <ToolTip>Enter the method parameter name</ToolTip>
          <Default>parameter</Default>
        </Object>
        <Object>
          <ID>StoredProcedureName</ID>
          <Type>string</Type>
          <ToolTip>Enter the Stored Procedure name</ToolTip>
          <Default>spName</Default>
        </Object>
        <Object>
          <ID>StoredProcedureParameterName</ID>
          <Type>string</Type>
          <ToolTip>Enter the Stored Procedure Parameter name</ToolTip>
          <Default>spParameterName</Default>
        </Object>
        <Object>
          <ID>StoredProcedureParameterValue</ID>
          <Type>string</Type>
          <ToolTip>Enter the Stored Procedure Value</ToolTip>
          <Default>spParameterValue</Default>
        </Object>
      </Declarations>
    </Snippet>
  </CodeSnippet>


  <CodeSnippet Format="1.0.0">

    <Header>
      <Title>
        mbProp
      </Title>
      <Shortcut>mbprop</Shortcut>
    </Header>
    <Snippet>
      <Code Language="CSharp">
        <![CDATA[		
		public $PropertyType$ $PropertyName$
		{
			get
      {
        if(this._$fieldName$ == null)
        {
          this._$fieldName$ = new $PropertyType$();
        }
        return this._$fieldName$;
      }
      set
      {
        this._$fieldName$ = value;
      }
		} 
    private $PropertyType$ _$fieldName$;
    ]]>
      </Code>

      <Declarations>
        <Object>
          <ID>PropertyType</ID>
          <Type>
            <![CDATA[ABusinessObject]]>
          </Type>
          <ToolTip>Replace with the type of the property</ToolTip>
          <Default><![CDATA[AbusinessObject]]></Default>
        </Object>
        <Object>
          <ID>PropertyName</ID>
          <Type>string</Type>
          <ToolTip>Replace with the name of the property</ToolTip>
          <Default>PropertyName</Default>
        </Object>
        <Object>
          <ID>fieldName</ID>
          <Type>string</Type>
          <ToolTip>Enter the field name</ToolTip>
          <Default>fieldName</Default>
        </Object>
      </Declarations>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform