Calling all Resharper users...

Posts   
 
    
Posts: 497
Joined: 08-Apr-2004
# Posted on: 11-Sep-2007 12:25:10   

As you all probably know, ReSharper is probably the best thing that ever happened to VS.NET, it makes development and especially re-factoring a joy.. Its to Visual Studio / Coding what LLBLGEN is to OR Mapping in .NET smile

Anyway, I'm going to create a set of templates for ReSharper that should make working with LLBL even easier/better! Does anyone have any that they might have already - we could compile a uber-template set for LLBLGen Development in ReSharper...

Jez
User
Posts: 198
Joined: 01-May-2006
# Posted on: 13-Sep-2007 13:46:53   

I use some simple LLBLGen-specific ReSharper templates, but nothing particularly fancy.

I have templates for: - Creating a Using block with a Data Access Adapter - Creating an Entity Collection - Creating a Prefetch path - Creating a sort expression - Creating a RelationPredicateBucket

kakaiya
User
Posts: 161
Joined: 20-Mar-2004
# Posted on: 15-Sep-2007 11:59:50   

Hi Jez,

Is it possible to share this template?

Regards,

kakss

Posts: 497
Joined: 08-Apr-2004
# Posted on: 17-Sep-2007 10:03:14   

I agree!

It would be good if you could post them, and we can add to them maybe in this thread?

Jez
User
Posts: 198
Joined: 01-May-2006
# Posted on: 17-Sep-2007 18:24:58   

Here they are:

Surroung with Data Access Adapter:

using(DataAccessAdapter adapter = new DataAccessAdapter())
{
    $SELECTION$
}

Create Data Access Adapter (shortcut: adapterblock)

using(DataAccessAdapter adapter = new DataAccessAdapter())
{
    END$
}

Create an Entity Collection (shortcut: coll)

EntityCollection<$TYPE$> collection = new EntityCollection<$TYPE$>(new $TYPE$Factory());

Create a Prefetch Path (shortcut: ppath)

PrefetchPath2 prefetcher = new PrefetchPath2(EntityType.$TYPE$);

Create a RelationPredicateBucket (shortcut: rel)

RelationPredicateBucket bucket = new RelationPredicateBucket(
    $END$
);

Create a SortExpression (shortcut: sort)

SortExpression sorter = new SortExpression(
    $END$
);

I can also post them as ReSharper template XML files if that would be of use.

kakaiya
User
Posts: 161
Joined: 20-Mar-2004
# Posted on: 18-Sep-2007 12:55:08   

Thanks Jez. I do appreciate it.

It would be good if you can advice how to information for Resharper?

Regards,

kakss

Jez
User
Posts: 198
Joined: 01-May-2006
# Posted on: 18-Sep-2007 17:50:50   

What type of information are you looking for?

kakaiya
User
Posts: 161
Joined: 20-Mar-2004
# Posted on: 20-Sep-2007 01:23:55   

Hi Jez

Looking for as ReSharper template XML files.

Thanks kakss

kakaiya
User
Posts: 161
Joined: 20-Mar-2004
# Posted on: 20-Sep-2007 08:23:07   

Hi Jez

Looking for as ReSharper template XML files.

Thanks kakss

Jez
User
Posts: 198
Joined: 01-May-2006
# Posted on: 20-Sep-2007 10:31:56   

Here are the templates in the Resharper XML file format:


<TemplatesExport>
  <Folder name="File 'LiveTemplates.xml'">
    <Template uid="1b0bef5f-4846-45f7-8283-9ea1be013bf9" text="using(DataAccessAdapter adapter = new DataAccessAdapter())&#xD;&#xA;{&#xD;&#xA;    $END$&#xD;&#xA;}" shortcut="adapterblock" description="Data Access Adapter Block" reformat="true" shortenQualifiedReferences="true">
      <Context>
        <CSharpContext context="Statement" />
      </Context>
      <Variables />
      <CustomProperties />
    </Template>
      <Context>
        <CSharpContext context="TypeMember" />
      </Context>
      <Variables>
        <Variable name="string" expression="" initialRange="0" />
        <Variable name="MyProperty" expression="" initialRange="0" />
      </Variables>
      <CustomProperties />
    </Template>
    <Template uid="acdf7fa3-02d1-4b7c-8d7b-bcc7335e7a89" text="EntityCollection&lt;$TYPE$&gt; collection = new EntityCollection&lt;$TYPE$&gt;(new $TYPE$Factory());" shortcut="coll" description="Create an entity collection" reformat="true" shortenQualifiedReferences="true">
      <Context>
        <CSharpContext context="Statement" />
      </Context>
      <Variables>
        <Variable name="TYPE" expression="" initialRange="0" />
      </Variables>
      <CustomProperties />
    </Template>
    <Template uid="a003da41-e52d-4197-8214-17b5eb0da59f" text="RelationPredicateBucket bucket = new RelationPredicateBucket(&#xD;&#xA;$END$&#xD;&#xA;);" shortcut="rel" description="Create a RelationPredicateBucket" reformat="true" shortenQualifiedReferences="true">
      <Context>
        <CSharpContext context="Statement" />
      </Context>
      <Variables />
      <CustomProperties />
    </Template>
    <Template uid="10265439-b54f-43a6-949d-7e958c5d4469" text="SortExpression sorter = new SortExpression(&#xD;&#xA;$END$&#xD;&#xA;);" shortcut="sort" description="Sort Expression" reformat="true" shortenQualifiedReferences="true">
      <Context>
        <CSharpContext context="Statement" />
      </Context>
      <Variables />
      <CustomProperties />
    </Template>
    <Template uid="2b8625c6-54df-4d73-a5cf-c152ea6f9931" text="PrefetchPath2 prefetcher = new PrefetchPath2(EntityType.$TYPE$);" shortcut="pp" description="Creates a PrefetchPath" reformat="true" shortenQualifiedReferences="true">
      <Context>
        <CSharpContext context="Statement" />
      </Context>
      <Variables>
        <Variable name="TYPE" expression="" initialRange="0" />
      </Variables>
      <CustomProperties />
    </Template>
  </Folder>
</TemplatesExport>

Posts: 497
Joined: 08-Apr-2004
# Posted on: 20-Sep-2007 11:02:54   

Excellent, I'll combine those with mine and post an update soon wink

Jez
User
Posts: 198
Joined: 01-May-2006
# Posted on: 20-Sep-2007 16:53:59   

Out of interest what templates do you use?

kakaiya
User
Posts: 161
Joined: 20-Mar-2004
# Posted on: 21-Sep-2007 02:52:04   

Hi all,

How to use above Resharper template in VS2005? What do I need to do?

Thanks kakss

Jez
User
Posts: 198
Joined: 01-May-2006
# Posted on: 21-Sep-2007 09:13:34   

With ReSharper installed go to:

ReSharper -> Options -> Live Templates

Then click the "mount file storage" button and point it to the XML file with the templates in.

kakaiya
User
Posts: 161
Joined: 20-Mar-2004
# Posted on: 21-Sep-2007 09:38:20   

Hi Jez,

When I try to import into Resharper it says:


Error Opening File

File format is invalid. Please make sure it is a valid templates file (created with Export Templates).

OK

Could you please ZIP the xml file and attach here.

Thanks a lot. Regards, kakss

Jez
User
Posts: 198
Joined: 01-May-2006
# Posted on: 21-Sep-2007 11:39:16   

Whoops, I had some extra stuff in there from another template that should have been deleted.

I can't seem to see a way to attach a file, but this is the XML for the fixed template.

<TemplatesExport>
  <Folder name="File 'LiveTemplates.xml'">
    <Template uid="1b0bef5f-4846-45f7-8283-9ea1be013bf9" text="using(DataAccessAdapter adapter = new DataAccessAdapter())&#xD;&#xA;{&#xD;&#xA;    $END$&#xD;&#xA;}" shortcut="adapterblock" description="Data Access Adapter Block" reformat="true" shortenQualifiedReferences="true">
      <Context>
        <CSharpContext context="Statement" />
      </Context>
      <Variables />
      <CustomProperties />
    </Template>
    <Template uid="acdf7fa3-02d1-4b7c-8d7b-bcc7335e7a89" text="EntityCollection&lt;$TYPE$&gt; collection = new EntityCollection&lt;$TYPE$&gt;(new $TYPE$Factory());" shortcut="coll" description="Create an entity collection" reformat="true" shortenQualifiedReferences="true">
      <Context>
        <CSharpContext context="Statement" />
      </Context>
      <Variables>
        <Variable name="TYPE" expression="" initialRange="0" />
      </Variables>
      <CustomProperties />
    </Template>
    <Template uid="a003da41-e52d-4197-8214-17b5eb0da59f" text="RelationPredicateBucket bucket = new RelationPredicateBucket(&#xD;&#xA;$END$&#xD;&#xA;);" shortcut="rel" description="Create a RelationPredicateBucket" reformat="true" shortenQualifiedReferences="true">
      <Context>
        <CSharpContext context="Statement" />
      </Context>
      <Variables />
      <CustomProperties />
    </Template>
    <Template uid="10265439-b54f-43a6-949d-7e958c5d4469" text="SortExpression sorter = new SortExpression(&#xD;&#xA;$END$&#xD;&#xA;);" shortcut="sort" description="Sort Expression" reformat="true" shortenQualifiedReferences="true">
      <Context>
        <CSharpContext context="Statement" />
      </Context>
      <Variables />
      <CustomProperties />
    </Template>
    <Template uid="2b8625c6-54df-4d73-a5cf-c152ea6f9931" text="PrefetchPath2 prefetcher = new PrefetchPath2(EntityType.$TYPE$);" shortcut="pp" description="Creates a PrefetchPath" reformat="true" shortenQualifiedReferences="true">
      <Context>
        <CSharpContext context="Statement" />
      </Context>
      <Variables>
        <Variable name="TYPE" expression="" initialRange="0" />
      </Variables>
      <CustomProperties />
    </Template>
  </Folder>
</TemplatesExport>
kakaiya
User
Posts: 161
Joined: 20-Mar-2004
# Posted on: 24-Sep-2007 02:29:54   

Thanks Jez.