Which VS.NET 2005 code snippets do you want to see from us?

Posts   
 
    
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 08-Nov-2005 11:37:01   

VS.NET 2005 has great new features, one of them is the new codesnippet feature. Now, we could provide some code snippets for you, prefabricated, but to be able to give you the snippets you want/need, we need a little feedback.

So which kind of code snippets do you want us to create for you? Please paste, if possible, an example of the code from your current work which could have been easier to write if codesnippets were available.

Thanks! simple_smile

ps: A code snippet is a pre-fabricated piece of code which has some variable elements you can fill in. It's a new feature in VS.NET 2005, which can be triggered by a shortcut right in the code editor and which will guide you through the variable elements to fill in. This can greatly speed up editing code. We're now looking into which pieces of code you want us to turn into a snippet so we can ship these on the website and with LLBLGen Pro for everybody. These snippets are then supported by us and extended if necessary.

See for details the VS.NET 2005 documentation about code snippets. Code snippets are supported in every VS.NET 2005 version, so also in Express.

Frans Bouma | Lead developer LLBLGen Pro
alexdresko
User
Posts: 336
Joined: 08-Jun-2004
# Posted on: 11-Nov-2005 17:30:59   

At first I couldn't think of any code snippets that might pertain to LLBLGen, but if it's possible, I think it would be great to have a "using" snippet that would insert the most common usings/Imports for LLBLGen..

using <rootnamespace>.EntityClasses; using <rootnamespace>.HelperClasses;

etc...

omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 11-Nov-2005 19:49:51   

A good candidate for code snippets (Adapter): 1- code to fetch entity by its PK 2- code to fetch entity by a RPBucket 3- code to fetch collection by RPBucket 4- code to save an entity 5- code to delete entity 6- code to save collection 7- code to delete collection

Posts: 497
Joined: 08-Apr-2004
# Posted on: 12-Nov-2005 11:54:26   

Its the construction of relation predicate buckets that IMO seems to cause the most amount of brain power - so the creation of some "common" relation predicate buckets would be a good thing.

For example, creating a rpbucket based on a simple where clause (customerID = 10), creating a rpbucket with a relationship and a where clause on the related table.

Also the creation of dynamic typed lists.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 12-Nov-2005 13:18:55   

Good suggestions, all! simple_smile Keep them coming!

I'll see if I can cook up some already this weekend and will post them on the website simple_smile

Frans Bouma | Lead developer LLBLGen Pro
davisg avatar
davisg
User
Posts: 113
Joined: 27-Feb-2005
# Posted on: 13-Nov-2005 22:41:02   

Maybe if you can also do something with UnitOfWork and Context that would be nice.... Common tasks.

Geoff.

omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 14-Nov-2005 15:21:04   

davisg wrote:

Maybe if you can also do something with UnitOfWork and Context that would be nice.... Common tasks.

Geoff.

I second that... specially for Context. I would also suggest to group these code snippets by senarios instead of by use. For eaxmple, one snippet code group could be titled (refetching objects from DB) could list snippets of using Context or using the adapter to re-fetch an entity collection from the DB

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 14-Nov-2005 15:39:03   

Code snippet for DataAccessAdapter.GetScalar() function with a groupby clause, filter, relation, expression, aggregate...etc. (all the possible parameters in its longest overload) :>

I think it will be usefull, as I remeber it took me sometime to get it at the first time. I can supply this one simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 14-Nov-2005 18:26:44   

Ok, I'm ready to go with some snippets, and I've planned some time tomorrow to get some snippets working. The ideas brought forward here are great, so I'll use these first to get a set of snippets up and running. simple_smile

(after 6 hours of code refactoring in a single collection class, you definitely want to do something else for a change wink )

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 15-Nov-2005 15:20:47   

It's also a clash of languages I think. The snippets coming with C# are very rudimentary, stored in a single folder and simply contain very often used constructs. The snippets for VB.NET however are grouped in various folders, and often contain code you type in without thinking (IMHO), though there's a snippet for it wink .

What I'm getting at is: if I provide a 10, 15 line snippet it might be worth it, but if it requires you to remove at least 7 lines it's not that worth it.

Writing them is pretty low level, but it's ok simple_smile I've now: (and I'm adding way more, the categorization of VB.NET is actually good, good idea Omar to bring that up simple_smile ) - adding using / Imports to the code file (adapter/selfservicing) - creating an entity collection (adapter). The selfservicing one is such a no-brainer, it takes more time to find the snippet than to type it in. - defining a using(DataAccessAdapter $adapter$ = new DataAccessAdapter()) { } block (also in VB) (adapter) - defining a 1 node prefetch path (adapter, selfservicing)

working on more simple_smile

The general shortcuts I use are: llblA__name_ for adapter stuff and llblS__name_ for selfservicing stuff.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 15-Nov-2005 17:07:26   

Ok, I'll first create a bunch of snippets and then will group them into groups, as I'm undecided what groups would be useful. 'Fetching data' is ok, but filter oriented stuff is related to fetching but kind of demands its own category IMHO.

Frans Bouma | Lead developer LLBLGen Pro
erichar11
User
Posts: 268
Joined: 08-Dec-2003
# Posted on: 15-Nov-2005 17:21:40   

Hey Frans, where do you think these snippets will be published? In the forums? On the site? In the manual? Just want to know where I should look.

It's a great idea.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 15-Nov-2005 17:40:18   

erichar11 wrote:

Hey Frans, where do you think these snippets will be published? In the forums? On the site? In the manual? Just want to know where I should look.

It's a great idea.

I'll continue to write templates till 6pm (that's half an hour from now) and then upload the archive to the 3rd party section (and will announce it in this thread) so you can have a look at the first attempt of me to write snippets. I'm definitely sure some will need tweaking, and more will be added shortly.

I think there are two kinds of templates to be added: 1) repetitive code helpers 2) best practises how do I - kinda templates.

the templates in category 2) will help novices but are useless for people who know what they're doing as they probably will insert code you don't need. So I'll keep a balance between the two. At the moment there's no special group for either of the two, as there's not a lot of templates at the moment. (writing them is harder than I thought. You write one, try it out, see it's silly and needs tweaking, go back, retry etc. simple_smile ) Nevertheless it's a great thing and I know it will help a lot of people out.

When the set of templates is more mature I'll move it into the installer.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 15-Nov-2005 19:23:02   

Ok, uploaded the first batch. Lots of stuff still to add, but it's a start. Let me know if these really suck or have problems or need tweaking simple_smile

They're available here: http://www.llblgen.com/pages/secure/betas.aspx

Frans Bouma | Lead developer LLBLGen Pro
alexdresko
User
Posts: 336
Joined: 08-Jun-2004
# Posted on: 15-Nov-2005 21:38:01   

Otis wrote:

Ok, uploaded the first batch. Lots of stuff still to add, but it's a start. Let me know if these really suck or have problems or need tweaking simple_smile

They're available here: http://www.llblgen.com/pages/secure/betas.aspx

Uhhhhh.. What about if there isn't an option called "Code Snippets Manager" under "Tools"? I'm using VS2005 TSE RTM ..

Ahhhhh.... this is strange.. It's missing from everyone's Tools menu here, but you can get it back by going to Tools/Customize and dragging the Code Snippets Manager back to the menu...

jtgooding
User
Posts: 126
Joined: 26-Apr-2004
# Posted on: 15-Nov-2005 22:12:17   

This is cool, I've used these features with a third party tool (CodeRush) for quite a while, it has a few features you can't do with the templates, but it's nice seeing the what's free bar being raised with snippets.

I looked over your snippets just to see of the ones that are similar to what I use and saw a small bug in the C# adapter dynamic list, you missed linking an identifier for the Adapter inside the using statement. Other than that they all seemed to work fine (C# adapter that is, only stuff I use hehe)

John

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 16-Nov-2005 12:32:30   

alexdresko wrote:

Otis wrote:

Ok, uploaded the first batch. Lots of stuff still to add, but it's a start. Let me know if these really suck or have problems or need tweaking simple_smile

They're available here: http://www.llblgen.com/pages/secure/betas.aspx

Uhhhhh.. What about if there isn't an option called "Code Snippets Manager" under "Tools"? I'm using VS2005 TSE RTM ..

Me too, but I have the feature there. (though I upgraded professional with the TSE install)

Ahhhhh.... this is strange.. It's missing from everyone's Tools menu here, but you can get it back by going to Tools/Customize and dragging the Code Snippets Manager back to the menu...

Which profile did you select?

jtgooding wrote:

This is cool, I've used these features with a third party tool (CodeRush) for quite a while, it has a few features you can't do with the templates, but it's nice seeing the what's free bar being raised with snippets.

Yes they're not that flexible but it's a start. What annoys me a lot is the differences in the template processor per language. C# has 'function' support (albeit pretty crappy) and vb.net doesn't. Why is there ANY difference... Why can't I hook an assembly I write into the snippet processor and call a method there, which would make it extensible forever...

I looked over your snippets just to see of the ones that are similar to what I use and saw a small bug in the C# adapter dynamic list, you missed linking an identifier for the Adapter inside the using statement. Other than that they all seemed to work fine (C# adapter that is, only stuff I use hehe) John

It's a first attempt, lots is still missing wink . Thanks for the glitch, I'll correct that simple_smile

Frans Bouma | Lead developer LLBLGen Pro