Snippet

Posts   
 
    
Meteor
User
Posts: 67
Joined: 06-Apr-2007
# Posted on: 03-Mar-2009 05:18:44   

Thought someone might find these useful - modified snippets for .Net 2.0 c# adapter 'CreateEntityCollection' and 'AddNamespaceReferences' for .Net 3.5 etc

Save me heaps of time by just typing 'llbl' and watching the magic take place sunglasses

(dont' forget to back up your orginal snippets before modifying..)


<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>Create EntityCollection Instance</Title>
      <Shortcut>llblA_CreateEntityCollection</Shortcut>
      <Description>Code snippet to create a new EntityCollection instance, adapter specific. </Description>
      <Author>Solutions Design</Author>
    </Header>
    <Snippet>
      <Declarations>
        <Literal Editable="true">
          <ID>EntityCollectionVariable</ID>
          <ToolTip>The variable which holds the EntityCollection instance reference</ToolTip>
          <Default>myCollection</Default>
        </Literal>
        <Literal Editable="true">
          <ID>EntityFactory</ID>
          <ToolTip>The factory to pass to the EntityCollection constructor</ToolTip>
          <Default>MyEntityFactory</Default>
        </Literal>
        <Literal>
          <ID>EntityTypeVariable</ID>
          <ToolTip>The variable which holds the EntityType instance reference</ToolTip>
          <Default>myEntity</Default>
        </Literal>
      </Declarations>
      <Code Language="csharp">
        <![CDATA[EntityCollection<$EntityTypeVariable$> $EntityCollectionVariable$ = new EntityCollection<$EntityTypeVariable$>(new $EntityTypeVariable$Factory());
$end$]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>


<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>Add namespace references to code file</Title>
      <Shortcut>llblA_AddNamespaceRefs</Shortcut>
      <Description>Code snippet to add all necessary namespace definitions to the current code file, adapter specific. </Description>
      <Author>Solutions Design</Author>
    </Header>
    <Snippet>
      <Declarations>
        <Literal Editable="true">
          <ID>RootNamespace</ID>
          <ToolTip>The root namespace of your generated project</ToolTip>
          <Default>DAL</Default>
          <Function>
          </Function>
        </Literal>
      </Declarations>
      <Code Language="csharp"><![CDATA[using System.Linq;
using $RootNamespace$.DatabaseSpecific;
using $RootNamespace$.EntityClasses;
using $RootNamespace$.FactoryClasses;
using $RootNamespace$.HelperClasses;
using $RootNamespace$.Linq;
using $RootNamespace$;
using SD.LLBLGen.Pro.ORMSupportClasses;
using SD.LLBLGen.Pro.LinqSupportClasses;
$end$]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 03-Mar-2009 07:09:42   

Thanks a bunch.